一、概述
zabbix proxy 可以代替 zabbix server 收集性能和可用性数据,然后把数据汇报给 zabbix server,并且在一定程度上分担了zabbix server 的压力.
二、proxy配置(129)
1、配置yum源
wget -O /etc/yum.repos.d/epel.repo
2、下载安装zabbix-proxy-mysql
yum localinstall -y zabbix-proxy-mysql-3.4.3-1.el7.x86_64.rpm -y
3、安装数据库
yum install -y mariadb mariadb-devel mariadb-server
systemctl start mariadb
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
4、配置zabbix-proxy配置文件
[root@db2 tmp]# grep '^[a-Z]' /etc/zabbix/zabbix_proxy.conf
Server=192.168.10.130
Hostname=zabbix-proxy
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=zabbix
DBPort=3306
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
5、设置hostname
hostname最好设置成和zabbix_proxy.conf中Hostname一致
hostnamectl set-hostname zabbix-proxy
6、数据库配置
mysql -S /var/lib/mysql/mysql.sock
create database zabbix_proxy default charset utf8;
grant all on zabbix_proxy.* to zabbix@localhost identified by 'zabbix';
rpm -ql zabbix-proxy-mysql
zcat /usr/share/doc/zabbix-proxy-mysql-3.4.3/schema.sql.gz|mysql -uzabbix -pzabbix zabbix_proxy -S /var/lib/mysql/mysql.sock
7、启动服务
systemctl start zabbix-proxy
三、agent配置(128)
[root@23bff2c4_1633529122 ~]# cat /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
DebugLevel=3
Server=192.168.10.129
ListenPort=10050
ListenIP=192.168.10.128
ServerActive=192.168.10.129
Hostname=192.168.10.128
HostMetadataItem=system.uname
Include=/etc/zabbix/zabbix_agentd.d/*.conf
UserParameter=tcp.status[*],ss -antp |awk '{a[$$1]++}END{print a["'$1'"]}'
Timeout=30
重启zabbix agentd
systemctl restart zabbix-agentd
四、web页面配置
1、proxy配置
2、主机添加并设置代理
重启一下proxy,加快数据收集
systemctl restart zabbix-proxy
tail -f /var/log/zabbix/zabbix_proxy.log