Install and Configure Zabbix Proxy

Video Lecture

Install and Configure Zabbix Proxy Install and Configure Zabbix Proxy Install and Configure Zabbix Proxy

Description

I install Zabbix Proxy to manage communication between the Server and Agents.

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: Raspbian GNU/Linux 10 (buster)

I will install it on a Raspberry Pi. My Raspberry Pi is running Raspbian Buster Lite (No desktop GUI).

The commands used in this lecture are, (note the buster_all in the commands below)

1
wget https://repo.zabbix.com/zabbix/5.0/raspbian/pool/main/z/zabbix-release/zabbix-release_5.0-1+buster_all.deb
1
dpkg -i zabbix-release_5.0-1+buster_all.deb
1
sudo apt update
1
sudo apt install -y zabbix-proxy-sqlite3

Edit Proxy Configuration file

Edit the Server, Hostname and DBName parameters.

1
sudo nano /etc/zabbix/zabbix_proxy.conf

zabbix_proxy.conf

Key Value Notes
Proxymode 0 0 = Active. This is the default already
Server zabbix.seanwasere.com 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

Notes

I use the actual network hostname for this value to avoid ambiguity between the several different uses of the term Host name 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

1
sudo service zabbix-proxy start

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.

Other Operating Systems

First install the repository for your OS.

Zabbix 5.0

Ubuntu 20.04 Focal

1
2
3
wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb
dpkg -i zabbix-release_5.0-1+focal_all.deb
apt update

Ubuntu 18.04 Bionic

1
2
3
wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+bionic_all.deb
dpkg -i zabbix-release_5.0-1+bionic_all.deb
apt update

Ubuntu 16.04 Xenial

1
2
3
wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+xenial_all.deb
dpkg -i zabbix-release_5.0-1+xenial_all.deb
apt update

Centos 8

1
2
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
dnf clean all

Centos 7

1
2
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all

Raspbian

1
2
3
sudo wget https://repo.zabbix.com/zabbix/5.0/raspbian/pool/main/z/zabbix-release/zabbix-release_5.0-1+buster_all.deb
sudo dpkg -i zabbix-release_5.0-1+buster_all.deb
sudo apt update

Zabbix 4.4

Ubuntu 20.04 Focal

1
2
3
wget https://repo.zabbix.com/zabbix/4.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.4-1+focal_all.deb
dpkg -i zabbix-release_4.4-1+focal_all.deb
apt update

Ubuntu 18.04 Bionic

1
2
3
wget https://repo.zabbix.com/zabbix/4.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.4-1+bionic_all.deb
dpkg -i zabbix-release_4.4-1+bionic_all.deb
apt update

Ubuntu 16.04 Xenial

1
2
3
wget https://repo.zabbix.com/zabbix/4.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.4-1+xenial_all.deb
dpkg -i zabbix-release_4.4-1+xenial_all.deb
apt update

Centos 8

1
2
rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm
dnf clean all

Centos 7

1
2
rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
yum clean all

Raspbian

1
2
3
sudo wget https://repo.zabbix.com/zabbix/4.4/raspbian/pool/main/z/zabbix-release/zabbix-release_4.4-1+buster_all.deb
sudo dpkg -i zabbix-release_4.4-1+buster_all.deb
sudo apt update

Install the Schema

There are 3 choices of package for the Zabbix Proxy.

  • zabbix-proxy-mysql
  • zabbix-proxy-pgsql
  • zabbix-proxy-sqlite3

SQLite3

With the sqlite3 version, you won't need to install the database schema since it will be automatically created when the proxy is first run. Note that it can sometimes take several minutes to first create the sqlite3 db file.

If you do want to create the schema first then

1
zcat /usr/share/doc/zabbix-proxy-sqlite3/schema.sql.gz | sqlite3 zabbix_proxy.db

MySQL

1
zcat /usr/share/doc/zabbix-proxy-mysql/schema.sql.gz | mysql -uzabbix -p zabbix

PostgreSQL

1
zcat /usr/share/doc/zabbix-proxy-pgsql/schema.sql.gz | sudo -u zabbix psql zabbix

Note

The zcat command can occasionally take several minutes to complete.

Install the Zabbix Proxy Service

Debian/Ubuntu/Raspbian

SQLite3

1
sudo apt install zabbix-proxy-sqlite3 zabbix-agent

MySQL

1
sudo apt install zabbix-proxy-mysql zabbix-agent

PostgreSQL

1
sudo apt install zabbix-proxy-pgsql zabbix-agent

Centos 7

SQLite3

1
sudo yum install zabbix-proxy-sqlite3 zabbix-agent

MySQL

1
sudo yum install zabbix-proxy-mysql zabbix-agent

PostgreSQL

1
sudo yum install zabbix-proxy-pgsql zabbix-agent

Centos 8

SQLite3

1
sudo dnf install zabbix-proxy-sqlite3 zabbix-agent

MySQL

1
sudo dnf install zabbix-proxy-mysql zabbix-agent

PostgreSQL

1
sudo dnf install zabbix-proxy-pgsql zabbix-agent

Edit Proxy Configuration File

1
nano /etc/zabbix/zabbix_proxy.conf

See #zabbix_proxyconf for Proxymode, Hostname and Server settings.

SQLite3

1
DBName=/tmp/zabbix_proxy.db

MySQL/PostgreSQL

Update these temp settings below with yours.

1
2
3
4
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=<password>

Note

Be aware that the Zabbix Server schema is different from the Zabbix Proxy schema. The Zabbix Proxy should use it's own database and not the Zabbix Servers.

Troubleshooting Proxy Setup

Double check notes above.

Check the output of

1
sudo service zabbix-proxy status

Check the output of

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

Note

A common problem is the name of your proxy in the Zabbix User Interface, Administration-->Proxies should be the same as your Hostname setting in the Zabbix proxy config in /etc/zabbix/zabbix_proxy.conf

Debian/Ubuntu/Raspbian

For more information about installing on Debian/Ubuntu/Raspbian visit, https://www.zabbix.com/documentation/current/manual/installation/install_from_packages/debian_ubuntu

Red Hat/Centos

For more information about installing on Red Hat/Centos visit, https://www.zabbix.com/documentation/current/manual/installation/install_from_packages/rhel_centos

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 there own configurations. The proxies own agent is discussed in the next section.

Proxies