一、报错详细信息
[root@host-47-98-97-124 ~]# tail -f /tmp/zabbix_agentd.log
11822:20180707:094214.749 starting zabbix agent [host-47-98-97-124]. zabbix 3.4.11 (revision 82160).
11822:20180707:094214.749 **** enabled features ****
11822:20180707:094214.749 ipv6 support: no
11822:20180707:094214.749 tls support: no
11822:20180707:094214.749 **************************
11822:20180707:094214.749 using configuration file: /usr/local/zabbix/etc/zabbix_agentd.conf
11822:20180707:094214.749 agent #0 started [main process]
11826:20180707:094214.750 agent #4 started [listener #3]
11823:20180707:094214.750 agent #1 started [collector]
11824:20180707:094214.750 agent #2 started [listener #1]
11825:20180707:094214.750 agent #3 started [listener #2]
11825:20180707:094221.059 failed to accept an incoming connection: connection from "127.0.0.1" rejected, allowed hosts: "47.98.97.124"
观察日志分析:来自“127.0.0.1”的连接被拒绝,只允许主机:“47.98.97.124”
二、分析zabbix的配置文件
zabbix-agentd配置文件
[root@host-47-98-97-124 zabbix]# egrep -ev '^#|^$' /usr/local/zabbix/etc/zabbix_agentd.conf
logfile=/tmp/zabbix_agentd.log
server=47.98.97.124
hostname=host-47-98-97-124
zabbix-server端配置文件
[root@host-47-98-97-124 zabbix]# egrep -ev '^#|^$' /usr/local/zabbix/etc/zabbix_server.conf
logfile=/tmp/zabbix_server.log
dbhost=47.98.97.124
dbname=zabbix
dbuser=zabbix
dbpassword=zabbix
dbsocket=/var/lib/mysql/mysql.sock
timeout=4
alertscriptspath=/usr/local/zabbix/scripts
logslowqueries=3000
通过配置文件分析:zabbix-agentd是通过47.98.97.124连接zabbix-server的,而不是127.0.0.1
三、解决方法
1.修改zabbix-agentd配置的server配置,改为127.0.0.1
2.在zabbix-server的web界面,将ip address地址127.0.0.1改为47.98.97.124(选择这个)
四、观察zabbix-agentd日志
[root@host-47-98-97-124 ~]# tail -f /tmp/zabbix_agentd.log
12562:20180707:101151.547 starting zabbix agent [host-47-98-97-124]. zabbix 3.4.11 (revision 82160).
12562:20180707:101151.548 **** enabled features ****
12562:20180707:101151.548 ipv6 support: no
12562:20180707:101151.548 tls support: no
12562:20180707:101151.548 **************************
12562:20180707:101151.548 using configuration file: /usr/local/zabbix/etc/zabbix_agentd.conf
12562:20180707:101151.548 agent #0 started [main process]
12565:20180707:101151.549 agent #3 started [listener #2]
12566:20180707:101151.549 agent #4 started [listener #3]
12563:20180707:101151.549 agent #1 started [collector]
12567:20180707:101151.550 agent #5 started [active checks #1]
12564:20180707:101151.550 agent #2 started [listener #1]
一切正常,没有报错!!!!