19.10.2023

Zabbix proxies for distributed monitoring

Zabbix proxy offloads the server or allows monitoring hosts that are unavailable for some reason (for example if they are located in a local network - its sometimes easier to forward a port for the proxy than to make the same for all hosts or make a VLAN), or it may be used as a backup system for maintenance. Proxy works pretty much similar to the server, minus the web server part: it has its own database, each period of time (specified in config) it asks the server what hosts it must look after, then it gets data from them and sends it further for processing.

Installation

Commands may vary for different systems, we are using a 20.04 Ubuntu with Mysql database, and commands for other OS are listed here.

Install everything needed (with root or sudo):

wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu20.04_all.deb
dpkg -i zabbix-release_6.4-1+ubuntu20.04_all.deb
apt update
apt install zabbix-proxy-mysql zabbix-sql-scripts

MySQL

Let's build a DB and get it ready for work:

mysql -u root -p
CREATE DATABASE zabbix_proxy CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *zabbix_proxy.* TO 'zabbix'@'localhost';
set global log_bin_trust_function_creators = 1;
exit;

Add the schemes and starting data:

cat /usr/share/zabbix-sql-scripts/mysql/proxy.sql | mysql --default-character-set=utf8mb4 -uzabbix_proxy -p zabbix_proxy

Log into MySQL again:

set global log_bin_trust_function_creators = 0;

Configuring proxy

Get proxy up:

service zabbix-proxy start

service zabbix-proxy enable

Check if it's working fine via:

service zabbix-proxy status

Configuring host

Open the control panel and go to Administration > Proxies > Create. Type its hostname, and choose active mode unless you change it.

 

After that, when adding hosts you can make them monitored via proxy or change the existing ones. While creating new hosts don't forget to add them to the agent's config, otherwise, it won’t work.

Conclusion

We looked into the reasons to use a proxy, how it can be done, and how to get it installed and ready for use.

You may be also interested in