CentOS 7.7 yum installation and configuration Zabbix 4.0 LTS details (9)
Add Linux hosts using Zabbix Proxy mode:
1. Simple instructions for Zabbix Proxy distributed monitoring:
Zabbix Proxy collects data from each Zabbix Agent and reports the collected data to Zabbix Server
2. Sh-proxy node deployment is consistent with zabbix-server node MySQL 5.7,
3. Sh-proxy node creates zabbix_proxy database and 'zbxproxy'@'192.168.0.%' user, and authorizes' zbxproxy'@'192.168.0.%' user to manage remotely:
# mysql-uroot-p
Mysql > create database zabbix_proxy character set utf8 collate utf8_bin
Mysql > create user 'zbxproxy'@'192.168.0.%' identified by' 123456'
Mysql > grant all on zabbix_proxy.* to 'zbxproxy'@'192.168.0.%'
Mysql > flush privileges
4. Install zabbix-proxy-mysql package on sh-proxy node: # yum-y install zabbix-proxy-mysql
5. Import the sh-proxy node into the schema.sql file and initialize the zabbix_proxy database:
# zcat / usr/share/doc/zabbix-proxy-mysql-4.0.14/schema.sql.gz | mysql- uzbxproxy-h292.168.0.121-p zabbix_proxy
6. Sh-proxy node modifies zabbix_proxy.conf configuration file:
# cd / etc/zabbix
# cp zabbix_proxy.conf {, .bak}
# vim zabbix_proxy.conf
Before modification
After modification
# ProxyMode=0
ProxyMode=0
Server=127.0.0.1
Server=192.168.0.120
# ServerPort=10051
ServerPort=10051
Hostname=Zabbix proxy
Hostname=sh-proxy
# ListenPort=10051
ListenPort=10051
# LogType=file
LogType=file
LogFile=/var/log/zabbix/zabbix_proxy.log
Keep the default
# DBHost=localhost
DBHost=192.168.0.121
DBName=zabbix_proxy
Keep the default
DBUser=zabbix
DBUser=zbxproxy
# DBPassword=
DBPassword=123456
# DBSocket=
DBSocket=/var/lib/mysql/mysql.sock
# DBPort=
DBPort=3306
# HeartbeatFrequency=60
HeartbeatFrequency=60
# ConfigFrequency=3600
ConfigFrequency=3600
# DataSenderFrequency=1
DataSenderFrequency=1
# ListenIP=0.0.0.0
ListenIP=192.168.0.121
ExternalScripts=/usr/lib/zabbix/externalscripts
Keep the default
# AllowRoot=0
AllowRoot=0
# User=zabbix
User=zabbix
7. Sh-proxy node starts Zabbix Proxy:
# systemctl start zabbix-proxy
# systemctl status zabbix-proxy
# ps aux | grep zabbix_proxy
# ss-tunlp | grep-w 10051
# tail-100 / var/log/zabbix/zabbix_proxy.log
8. Configure self-boot: # systemctl enable zabbix-proxy
9. The node-122 node modifies the zabbix_agentd.conf configuration file to change the values of parameters Server and ServerActive to the IP corresponding to the sh-proxy node:
# vim / etc/zabbix/zabbix_agentd.conf
Before modification
After modification
PidFile=/var/run/zabbix/zabbix_agentd.pid
Keep the default
# LogType=file
LogType=file
LogFile=/var/log/zabbix/zabbix_agentd.log
Keep the default
LogFileSize=0
Keep the default
# EnableRemoteCommands=0
EnableRemoteCommands=1
Server=127.0.0.1
Server=192.168.0.121
# ListenPort=10050
ListenPort=10050
# ListenIP=0.0.0.0
ListenIP=192.168.0.122
ServerActive=127.0.0.1
ServerActive=192.168.0.121
Hostname=Zabbix server
Hostname=node-122
# AllowRoot=0
AllowRoot=0
# User=zabbix
User=zabbix
Include=/etc/zabbix/zabbix_agentd.d/*.conf
Keep the default
# UnsafeUserParameters=0
UnsafeUserParameters=1
10. Node-122 node restarts Zabbix Agent:# systemctl restart zabbix-agent
11. Sh-proxy node restarts Zabbix Proxy:# systemctl restart zabbix-proxy
12. Sh-proxy nodes use zabbix-get for value testing:
# yum-y install zabbix-get
# zabbix_get-s 192.168.0.122-k system.uname
13. Add proxy to Zabbix Web:
Administration-- > Proxies-- > Create proxy-- > Add
14. Zabbix Web modifies the value of node-122 node "Monitored by proxy" to sh-proxy:
15. View the latest monitoring data of node-122 nodes:
16. Install zabbix-agent package on sh-proxy node: # yum-y install zabbix-agent
17. The sh-proxy node modifies the zabbix_agentd.conf configuration file:
# cd / etc/zabbix
# cp zabbix_agentd.conf {, .bak}
# vim zabbix_agentd.conf
Before modification
After modification
PidFile=/var/run/zabbix/zabbix_agentd.pid
Keep the default
# LogType=file
LogType=file
LogFile=/var/log/zabbix/zabbix_agentd.log
Keep the default
LogFileSize=0
Keep the default
# EnableRemoteCommands=0
EnableRemoteCommands=1
Server=127.0.0.1
Server=192.168.0.121
# ListenPort=10050
ListenPort=10050
# ListenIP=0.0.0.0
ListenIP=192.168.0.121
ServerActive=127.0.0.1
ServerActive=192.168.0.121
Hostname=Zabbix server
Hostname=sh-proxy
# AllowRoot=0
AllowRoot=0
# User=zabbix
User=zabbix
Include=/etc/zabbix/zabbix_agentd.d/*.conf
Keep the default
# UnsafeUserParameters=0
UnsafeUserParameters=1
Note: the IP of Zabbix Server is not configured in the parameters Server and ServerActive, but Zabbix Proxy's own IP
18. Sh-proxy node starts Zabbix Agent:
# systemctl start zabbix-agent
# systemctl status zabbix-agent
# ps aux | grep zabbix_agent
# ss-tunlp | grep-w 10050
# tail-100 / var/log/zabbix/zabbix_agentd.log
19. Configure self-boot: # systemctl enable zabbix-agent
20. Sh-proxy node restarts Zabbix Proxy:# systemctl restart zabbix-proxy
21. Zabbix Web add sh-proxy node:
Configuration-- > Hosts-- > Create host-- > Add
22. Sh-proxy node links Linux monitoring template:
23. View the latest monitoring data of sh-proxy nodes: