说明:
环境:
server ip:172.16.2.116
proxy ip:172.16.2.241
系统为:CentOS 7.2
1、安装数据库,创建proxy数据库,proxy用户
[root@proxy ~]#yum -y install mariadb mariadb-server [root@proxy ~]#systemctl restart mariadb [root@proxy ~]#systemctl enable mariadb [root@proxy ~]#mysql_secure_installation #设置数据库root密码,按步骤操作即可 [root@proxy ~]#mysq -uroot -p MariaDB> create database zabbix_proxy character set utf8; MariaDB> GRANT ALL PRIVILEGES ON zabbix_proxy.* to ‘zabbix‘@‘localhost‘ IDENTIFIED BY ‘Proxy123!‘; MariaDB> flush privileges;
2、打开防火墙,本文以firewall为例
proxy默认监听的是10051 tcp端口,和zabbix server是一样的
[root@proxy ~]# firewall-cmd --permanent --add-port=10051/tcp success [root@proxy ~]# firewall-cmd --reload success [root@proxy ~]#
3、安装proxy
[root@proxy ~]#rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm [root@proxy ~]#yum install -y zabbix-proxy zabbix-proxy-mysql zabbix-agent
4、导入结构
[root@proxy ~]# cd /usr/share/doc/zabbix-proxy-mysql-3.4.7/ [root@proxy /usr/share/doc/zabbix-proxy-mysql-3.4.14~]#zcat schema.sql.gz |mysql -uroot -p zabbix_proxy (使用mysql数据的root用户密码)
5、编辑配置文件
proxy配置文件如下
[root@proxy /usr/share/doc/zabbix-proxy-mysql-3.4.14]# cat /etc/zabbix/zabbix_proxy.conf |grep -v "^#"|grep -v "^$" Server=172.16.2.116 Hostname=backup2 LogFile=/var/log/zabbix/zabbix_proxy.log LogFileSize=0 PidFile=/var/run/zabbix/zabbix_proxy.pid SocketDir=/var/run/zabbix DBHost=localhost DBName=zabbix_proxy DBUser=zabbix DBPassword=Proxy123! StartDiscoverers=4 JavaGateway=127.0.0.1 StartJavaPollers=4 SNMPTrapperFile=/var/log/snmptrap/snmptrap.log Timeout=4 ExternalScripts=/usr/lib/zabbix/externalscripts LogSlowQueries=3000
agent配置文件
[root@proxy /usr/share/doc/zabbix-proxy-mysql-3.4.7]# cat /etc/zabbix/zabbix_agentd.conf |grep -v "^#"|grep -v "^$" PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_agentd.log LogFileSize=0 Server=172.16.2.241 ServerActive=172.16.2.241 Hostname=backup2 Include=/etc/zabbix/zabbix_agentd.d/*.conf
6、到zabbix web页面上新增代理
最后大功告成
原文:https://www.cnblogs.com/ytyzhn/p/12659783.html