Skip to content

Install and Configure Zabbix Proxy

Video Lecture

Install and Configure Zabbix Proxy Install and Configure Zabbix Proxy

Description

I start with a brand-new installation of Raspberry Pi OS Lite. I use the 64 Bit version without the Desktop GUI.

You can get the installer from https://www.raspberrypi.com/software/

Raspberry Pi OS Lite doesn't enable SSH by default.

Read Troubleshooting Raspberry Pi OS before continuing since there are potentially breaking changes since April 2022.

If you are installing an older version of Raspberry Pi and you haven't enabled SSH in the installer, then continue with these instructions.

To enable SSH, plug in an HDMI cable with monitor attached.

Plug in a USB keyboard.

Power it up.

When boot sequence has finished,

sudo raspi-config

Navigate to option 3 Interface Options.

Select I2 SSH and enable.

Go Back to main menu.

You may also want to select 6 Advanced Options and select A1 Expand Filesystem to use all the SD card.

Go Back to main menu and select Finish

sudo reboot now

I then use my SSH client and log into the Raspberry Pi. Default username is pi and default password is raspberry

You can change the default Raspberry Pi password by using the passwd command.

Next,

I install Zabbix Proxy to manage communication between the Server and Agents on my local network.

Note

It is important to know which operating system you intend to use for your proxy. To find which operating system you are using, at the prompt, type one of these commands,

hostnamectl

cat /etc/os-release

lsb_release -a

On my raspberry pi, hostnamectl returns Operating System: Debian GNU/Linux 11 (bullseye)

I select Raspberry Pi OS for the OS distribution and 11 Bullseye for the OS version on the Zabbix download page.

My Raspberry Pi is running Raspbian PI OS Lite (64 Bit) (No desktop GUI).

The commands used in this lecture are,

sudo wget https://repo.zabbix.com/zabbix/6.0/raspbian/pool/main/z/zabbix-release/zabbix-release_6.0-2+debian11_all.deb
sudo dpkg -i zabbix-release_6.0-2+debian11_all.deb
sudo apt update
sudo apt install zabbix-proxy-sqlite3

Other database options for Zabbix proxy are MySQL and PostgreSQL.

They can be installed by using

sudo apt install zabbix-proxy-mysql

or

sudo apt install zabbix-proxy-pgsql

Note that with the sqlite3 version, you won't need to install the database schema since it will be automatically created if it doesn't already exist.

If you use MySQL or PostgreSQL then you also need to install the schema.

Visit the official Zabbix Proxy install documentation at https://www.zabbix.com/documentation/current/en/manual/installation/install_from_packages/debian_ubuntu#proxy-installation

Edit Proxy Configuration file

Edit the Server, Hostname and DBName parameters.

sudo nano /etc/zabbix/zabbix_proxy.conf

zabbix_proxy.conf

Key Value Notes
Proxymode 0 0 = Active. This is the default already
Server zabbix.sbcode.net The DNS name of my Zabbix server. You could use IP address if you don't have a DNS name.
Hostname raspberrypi (see notes below)
DBName /tmp/zabbix_proxy.db I am using the SQLite3 database option

Note

I use the actual network hostname for this value to avoid ambiguity between the several uses of the term Hostname in the Zabbix documentation and UI. I just use the same name as is returned from entering the command hostname on my proxy server. When I enter hostname on my proxy server, it returns raspberrypi

I save, then I enter

sudo service zabbix-proxy start

To ensure that Zabbix Proxy auto starts after reboot then enter,

sudo systemctl enable zabbix-proxy.service

Add Proxy to Zabbix Server UI

I then create the proxy in Zabbix Server UI, then after several seconds, I refresh the proxy config screen and it will show that the proxy is now in communication with the server.

Zabbix UI ⇾ Administration ⇾ Proxies

Key Value Notes
Proxy name raspberrypi (see notes below)
Proxy mode Active The is the same as is set on the configuration file on the proxy server.

Note

The Proxy name must be the same name you configured in the Hostname parameter in the proxy configuration file /etc/zabbix/zabbix_proxy.conf on your proxy server. In my example, it doesn't matter that my Zabbix server is on a different network than the proxy. All messages received on the Zabbix Server from the external Proxy will contain this hostname in the payload, so the Zabbix Server process will reject anything that doesn't match.

Also note that the Proxy name is the only required parameter on this form. You don't need anything else to make it work.

For extra security also use PSK encryption, but that is discussed later on the course in the section Enable PSK Encryption. The process is conceptually the same for the Proxy, except, you add your PSK values to the /etc/zabbix/zabbix_proxy.conf on your proxy server, rather than the agent configs /etc/zabbix/zabbix_agentd.conf as discussed in the example. You also configure this on the Zabbix UI in the Administration ⇾ proxies ⇾ [Your proxy] ⇾ Encryption. This method is for communications between the Zabbix server and the Proxy only. I advise doing the Agent example of setting up PSK before trying to do PSK encryption for the Zabbix Server<-->Proxy communications unless you are totally confident you know what you are doing. Make sure all your communications between all your hosts, proxies, server are working before adding encryption to any parts of the communications between any components, since it wil make problem solving much harder. Solve one problem at a time.

Troubleshooting

Proxy Configuration

Check the output of

sudo service zabbix-proxy status

Check the output of

sudo tail -f /var/log/zabbix/zabbix_proxy.log

Also be sure that the name of your proxy in the Zabbix User Interface, Administration ⇾ Proxies is the same as your Hostname setting in the Zabbix proxy config in /etc/zabbix/zabbix_proxy.conf

Raspberry Pi OS

If when logging into a new installation of Raspberry Pi, you get a Acces denied error for the pi user, then it may be that you have installed the latest version of Raspberry Pi OS.

Since April 2022, Raspberry Pi OS no longer contains the default user pi. You need to manually add your own custom user when creating the installation image.

After selecting the operating system Raspberry Pi OS Lite (64 -bit), press the gear icon,

Raspberry Pi Imager Gear Icon

And then Enable SSH and set a username and password, or use the SSH public key authentication option if you prefer.

Raspberry Pi Imager set SSH and Username/Password

PSK Encryption between the Proxy and Server

Later on, you may be tempted to add PSK encryption between your Zabbix server and the Proxy. PSK is discussed more later on in the course.

You may see an error in the Proxy logs, cannot send proxy data to server at "zabbix.your-domain.tld": connection of type "TLS with PSK" is not allowed for proxy "your-proxy"

When setting up PSK encryption for communications specifically between the Proxy and Server, you should add the PSK Identity and Secret to Administration ⇾ Proxies ⇾ [Your proxy] ⇾ Encryption and also adjust the settings inside the file /etc/zabbix/zabbix_proxy.conf

If you also want Encryption between your Proxy and its local Agent, then create another secret for the agent, set its PSK settings in the Proxy Agents Host configuration at Configuration ⇾ Hosts ⇾ [Your proxy] ⇾ Encryption, and modify the settings in the file /etc/zabbix/zabbix_agentd.conf

Understand that the Proxy process, and the Proxies own Agent process are two different things with their own configurations. The proxies own agent is discussed in the next section.

Proxies

Comments