summary
Zabbix Proxy can replace Zabbix Server to collect performance and availability data of host devices, so as to reduce the pressure of Zabbix Server.
Zabbix Proxy can be used to:
- Monitor remote location host equipment
- Monitor the location of host and equipment with unreliable communication
- Reduce the pressure on Zabbix Server in large-scale monitoring scenarios
- Simplify the maintenance of distributed monitoring

All data collected by Zabbix Proxy is stored in the local database before being transferred to the server. In this way, data will not be lost due to any temporary communication problems with the server. The ProxyLocalBuffer and ProxyOfflineBuffer parameters in the agent configuration file control how long the data is saved locally.
The Proxy directly updates the latest configuration from the Zabbix Server database, which may be newer than the Zabbix Server, and the configuration of Zabbix Server cannot be updated quickly due to CacheUpdateFrequency. Therefore, the data collected and sent by Proxy to Zabbix Server may be ignored.
Zabbix Server cache update frequency, in seconds. Default 60
CacheUpdateFrequency=60
Force update zabbix_server cache
sudo zabbix_server -R config_cache_reload
Ubuntu system optimization
Optimize the number of file openings and the maximum number of processes
egrep -v "*#|^$" /etc/security/limits.conf * soft nofile 65536 * hard nofile 65536 * soft nproc 65536 * hard nproc 65536
Optimize the system switching partition, virtual memory, port, maximum listening queue, maximum number of files opened and other parameters
vim /etc/sysctl.conf vm.swappiness = 0 vm.max_map_count = 262144 net.core.somaxconn = 65535 fs.file-max = 655360 net.ipv4.ip_forward = 1
Execute sysctl -p to optimize kernel parameters
#View the maximum number of open file descriptors ulimit -n #View the maximum number of processes available to the user ulimit -u #View VM Swappiness parameter cat /proc/sys/vm/swappiness #View VM max_ map_ Count parameter sysctl -a|grep vm.max_map_count #View net core. Somaxconn parameter sysctl -a | grep net.core.somaxconn #View FS File Max parameter cat /proc/sys/fs/file-nr
Restart the system
Installing the Zabbix repository
sudo wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1+ubuntu20.04_all.deb
sudo dpkg -i zabbix-release_6.0-1+ubuntu20.04_all.deb
Update the list of available packages
sudo apt update
MySQL
Support character sets utf8 (utf8mb3) and utf8mb4 (using utf8_bin and utf8mb4_bin collation respectively) so that the Zabbix server / agent and MySQL database work normally. It is recommended to use utf8mb4 for new installation.
Install Mysql
sudo apt install -y mysql-server
For Ubuntu 20.04, the default repository MYSQL version is 8.0.28
Initialize database
sudo mysql_secure_installation
Step 1:
Press y|Y for Yes, any other key for No: N
Step 2: enter the mysql password you want to set twice
New password:
Re-enter new password:
Step 3: ask if you want to delete anonymous users?
Remove anonymous users? (press y|y for yes, any other key for no): N
Step 4: cancel the remote link?
Disallow root login remotely? (press y|y for yes, any other key for no): N (select N to allow root remote connection)
Step 5: delete the test database?
Remove test database and access to it? (press y|y for yes, any other key for no): N (select N, do not delete the test database)
Step 6: will the modified permission take effect immediately?
Reload privilege tables now? (press Y|y for yes, any other key for no): Y
When the following prompt appears, the setting is successful
Success.
All done!
Create and authorize zabbix libraries and users
#Login database sudo mysql -uroot -p #Create zabbix database mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin; #Create zabbix user mysql> create user 'zabbix'@'%' identified by 'zabbix@zabbix'; #Authorize localhost access mysql> grant all privileges on zabbix.* to 'zabbix'@'%'; #Refresh policy flush privileges; #sign out mysql> quit;
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin; Query OK, 1 row affected (0.01 sec) mysql> create user 'zabbix'@'%' identified by 'zabbix@zabbix'; Query OK, 0 rows affected (0.03 sec) mysql> grant all privileges on zabbix.* to 'zabbix'@'%'; Query OK, 0 rows affected (0.01 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> quit Bye
MYSQL database version
ubuntu@zabbix-proxy01:~$ mysql -V mysql Ver 8.0.28-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))
Note: Zabbix Server and Zabbix Proxy cannot use the same database. If they are installed on the same host, the agent database must have a different name.
MYSQL 8.0 remote cannot connect
MYSQL can only log in locally, but cannot log in remotely. ss -ntl |grep -w 3306 view the database. The default listening address is 127.0.0.1.
Modify profile
/etc/mysql/mysql.conf.d/mysqld.cnf bind-address = 0.0.0.0 mysqlx-bind-address = 0.0.0.0
Restart database
sudo systemctl restart mysql
Install ZABBIX proxy
sudo apt install zabbix-proxy-mysql zabbix-sql-scripts
Optional
sudo apt install zabbix-get zabbix-sender zabbix-agent2
Import data
Import initial schema:
sudo cat /usr/share/doc/zabbix-sql-scripts/mysql/proxy.sql | mysql -uzabbix -p zabbix
Note: in the new version, the names of server and Proxy database initialization files are distinguished. Server is "server.sql", Proxy is "proxy.sql", and the same installation package named "ZABBIX SQL scripts" is used.
zabbix_proxy profile
ubuntu@zabbix-proxy01:/$ sudo egrep -v "*#|^$" /etc/zabbix/zabbix_proxy.conf Server=192.168.99.185;192.168.99.186 Hostname=Zabbixproxy01 LogFile=/var/log/zabbix/zabbix_proxy.log LogFileSize=0 PidFile=/run/zabbix/zabbix_proxy.pid SocketDir=/run/zabbix DBHost=127.0.0.1 DBName=zabbix DBUser=zabbix DBPassword=zabbix@zabbix ProxyOfflineBuffer=2 ConfigFrequency=120 DataSenderFrequency=2 StartPollers=30 StartPollersUnreachable=10 StartPingers=1 StartDiscoverers=1 SNMPTrapperFile=/var/log/snmptrap/snmptrap.log CacheSize=512M Timeout=4 FpingLocation=/usr/bin/fping Fping6Location=/usr/bin/fping6 LogSlowQueries=3000 StatsAllowedIP=127.0.0.1
Start the Zabbix Proxy process
# systemctl restart zabbix-proxy # systemctl enable zabbix-proxy
Introduction to some parameters of Zabbix Proxy
ConfigFrequency=60 #How often does the Zabbix Proxy get configuration data from the Zabbix Server DataSenderFrequency=2 #Frequency of Zabbix Proxy sending monitored data to Zabbix Server ProxyOfflineBuffer=2 # When the Proxy or Server cannot be connected, the time to retain offline monitoring data, unit: hour StartPollers=10 #Number of open multithreads StartPollersUnreachable=1 #This thread is used to monitor the unconnected hosts separately StartPingers=10 # Number of fping threads CacheSize=64M #The number of caches used to save monitoring data is adjusted according to the number of monitoring hosts Timeout=10 #The timeout time shall not exceed 30s, otherwise it will slow down the capture time of other monitoring data
Zabbix front end configuration
Manage → agent click → create agent

The Proxy name must be the same as the Hostname parameter in the configuration file
proxy pattern
Active - the Proxy will connect to the Zabbix server and request configuration data (default)
Passive - Zabbix server connected to Proxy
0 - proxy in the active mode
1 - proxy in the passive mode

Official documents
https://www.zabbix.com/documentation/6.0/en/manual/distributed_monitoring/proxies