我们需要在 Server 中加入zabbix server的IP地址
代码语言:javascript复制[root@zbx-target zabbix]# vim zabbix_agentd.conf
[root@zbx-target zabbix]# grep -v "^#" /etc/zabbix/zabbix_agentd.conf | grep -v "^$"
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.66.123,127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server
Include=/etc/zabbix/zabbix_agentd.d/
[root@zbx-target zabbix]#
打开防火墙
代码语言:javascript复制[root@zbx-target script]# vim /etc/sysconfig/iptables
[root@zbx-target script]# grep 10050 /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
[root@zbx-target script]# /etc/init.d/iptables reload
iptables: Trying to reload firewall rules: [ OK ]
[root@zbx-target script]# iptables -L -nv | grep 10050
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:10050
[root@zbx-target script]#
默认情况下 zabbix_agentd 会监听在 0.0.0.0:10050
上面,所以要将防火墙打开,以方便与zabbix server之间的通信
启动zabbix-agent
代码语言:javascript复制[root@zbx-target zabbix]# /etc/init.d/zabbix-agent start
Starting Zabbix agent: [ OK ]
[root@zbx-target zabbix]# ps faux | grep zabbix | grep -v grep
zabbix 26124 0.0 0.0 77336 1144 ? S 16:11 0:00 zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
zabbix 26126 0.0 0.0 77336 1564 ? S 16:11 0:00 _ zabbix_agentd: collector [idle 1 sec]
zabbix 26127 0.0 0.0 77336 968 ? S 16:11 0:00 _ zabbix_agentd: listener #1 [waiting for connection]
zabbix 26128 0.0 0.0 77336 1108 ? S 16:11 0:00 _ zabbix_agentd: listener #2 [waiting for connection]
zabbix 26129 0.0 0.0 77336 968 ? S 16:11 0:00 _ zabbix_agentd: listener #3 [waiting for connection]
zabbix 26130 0.0 0.0 77348 1136 ? S 16:11 0:00 _ zabbix_agentd: active checks #1 [idle 1 sec]
[root@zbx-target zabbix]# netstat -ant | grep 10050
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN
tcp 0 0 192.168.66.5:10050 192.168.66.123:38010 TIME_WAIT
tcp 0 0 192.168.66.5:10050 192.168.66.123:38072 TIME_WAIT
tcp 0 0 :::10050 :::* LISTEN
[root@zbx-target zabbix]#