A Zabbix proxy can collect performance and availability data on behalf of the Zabbix server. This way, a proxy can take on itself some of the load of collecting data and offload the Zabbix server.
Also, using a proxy is the easiest way of implementing centralized and distributed monitoring, when all agents and proxies report to one Zabbix server and all data is collected centrally.
A Zabbix proxy can be used to:
-
Monitor remote locations
-
Monitor locations having unreliable communications
-
Offload the Zabbix server when monitoring thousands of devices
-
Simplify the maintenance of distributed monitoring
zabbix-proxy安装
[root@zabbix-proxy ~]# yum -y install zabbix-proxy zabbix-proxy-mysql mysql-server
[root@zabbix-proxy ~]# rpm -ql zabbix-proxy-mysql
/etc/init.d/zabbix-proxy
/etc/logrotate.d/zabbix-proxy
/etc/zabbix/zabbix_proxy.conf
/usr/lib/zabbix/externalscripts
/usr/sbin/zabbix_proxy_mysql
/usr/share/doc/zabbix-proxy-mysql-3.2.3
/usr/share/doc/zabbix-proxy-mysql-3.2.3/AUTHORS
/usr/share/doc/zabbix-proxy-mysql-3.2.3/COPYING
/usr/share/doc/zabbix-proxy-mysql-3.2.3/ChangeLog
/usr/share/doc/zabbix-proxy-mysql-3.2.3/NEWS
/usr/share/doc/zabbix-proxy-mysql-3.2.3/README
/usr/share/doc/zabbix-proxy-mysql-3.2.3/schema.sql.gz
/usr/share/man/man8/zabbix_proxy.8.gz
/var/log/zabbix
/var/run/zabbix
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
cd /usr/share/doc/zabbix-proxy-mysql-3.2.3
zcat schema.sql.gz | mysql -uroot zabbix_proxy
[root@zabbix-proxy ~]# grep '^[a-Z]' /etc/zabbix/zabbix_proxy.conf
ProxyMode=0
Server=172.16.8.100
Hostname=proxy-node1
LogFile=/var/log/zabbix/zabbix_proxy.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_proxy.pid
DBHost=localhost
DBName=/tmp/zabbix_proxy.sqlite3.db
DBUser=zabbix
DBPassword=zabbix
DBSocket=/var/lib/mysql/mysql.sock
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
原来proxy强制使用SQLite,所以必须指定一个数据库文件存放目录。
解决方案:
于是放开DBName参数并修改为:
DBName=/tmp/zabbix_proxy.sqlite3.db
报错信息
2664:20161228:212824.953 Starting Zabbix Proxy (active) [proxy-node1]. Zabbix 3.2.3 (revision 64610).
2664:20161228:212824.953 **** Enabled features ****
2664:20161228:212824.953 SNMP monitoring: YES
2664:20161228:212824.953 IPMI monitoring: YES
2664:20161228:212824.953 Web monitoring: YES
2664:20161228:212824.953 VMware monitoring: YES
2664:20161228:212824.953 ODBC: YES
2664:20161228:212824.953 SSH2 support: YES
2664:20161228:212824.953 IPv6 support: YES
2664:20161228:212824.953 TLS support: YES
2664:20161228:212824.953 **************************
2664:20161228:212824.953 using configuration file: /etc/zabbix/zabbix_proxy.conf
2664:20161228:212824.954 cannot open database file "zabbix": [2] No such file or directory
2664:20161228:212824.954 creating database ...
2664:20161228:212824.954 [Z3002] cannot create database 'zabbix': [0] unable to open database file
报错信息
[root@zabbix-proxy zabbix-proxy-mysql-3.2.3]# tail -f /var/log/zabbix/zabbix_proxy.log
2782:20161228:223526.955 temporarily disabling Zabbix agent checks on host "zabbix-proxy": host unavailable
2787:20161228:223533.466 cannot send list of active checks to "172.16.8.99": host [Zabbix server] not found
2787:20161228:223733.599 cannot send list of active checks to "172.16.8.99": host [Zabbix server] not found
2787:20161228:223933.726 cannot send list of active checks to "172.16.8.99": host [Zabbix server] not found
2787:20161228:224133.883 cannot send list of active checks to "172.16.8.99": host [Zabbix server] not found
2787:20161228:224333.006 cannot send list of active checks to "172.16.8.99": host [Zabbix server] not found
2787:20161228:224533.123 cannot send list of active checks to "172.16.8.99": host [Zabbix server] not found
2787:20161228:224733.249 cannot send list of active checks to "172.16.8.99": host [Zabbix server] not found
2787:20161228:224933.379 cannot send list of active checks to "172.16.8.99": host [Zabbix server] not found
2787:20161228:225133.514 cannot send list of active checks to "172.16.8.99": host [Zabbix server] not found
解决办法如下:
[root@zabbix-proxy ~]# grep '^[a-Z]' /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=172.16.8.99
ServerActive=172.16.8.100
Hostname=zabbix-proxy
Include=/etc/zabbix/zabbix_agentd.d/*.conf
[root@zabbix-proxy ~]# /etc/init.d/zabbix-agent restart
[root@zabbix-proxy ~]# /etc/init.d/zabbix-proxy restart
添加一个代理
zabbix3.2-proxy实现分布式监控
最新推荐文章于 2024-08-09 15:39:53 发布