主机运行时,会报这个错,所以要先按安装Zabbix agent,
Zabbix-server在监控的过程中,发现Web上报错提示zabbix server与agent之间已经失联超过5分钟了,为了找到问题出现的根本原因,在troubleshouting的时候,应该首先去查看服务对应的日志。首先应该查看server端的日志有无错误消息,通过日志查看,发现server端运行正常,那么问题很可能就出现在了客户端上,来到这台agent上查看服务日志。
1.查看日志
[root@iZbp11rfoyeescusr9ha9qZ tmp]# find / -name *agentd.log
/var/log/zabbix/zabbix_agentd.log
[root@iZbp11rfoyeescusr9ha9qZ tmp]# vim /var/log/zabbix/zabbix_agentd.log
23904:20170310:092458.633 Starting Zabbix Agent [Zabbix server]. Zabbix 2.2.16 (revision 64243).
23904:20170310:092458.634 using configuration file: /etc/zabbix_agentd.conf
23915:20170310:092458.636 agent #1 started [listener #1]
23918:20170310:092458.636 agent #3 started [listener #3]
23917:20170310:092458.636 agent #2 started [listener #2]
23914:20170310:092458.636 agent #0 started [collector]
23919:20170310:092458.637 agent #4 started [active checks #1]
23919:20170310:092458.637 active check configuration update from [127.0.0.1:10051] started to fail (cannot connect to [[127.0.0.1]:10051]: [111] Connection refused)
23919:20170310:102358.983 active check configuration update from [127.0.0.1:10051] is working again
23919:20170310:102358.983 no active checks on server [127.0.0.1:10051]: host [Zabbix server] not monitored
23919:20170310:102559.020 no active checks on server [127.0.0.1:10051]: host [Zabbix server] not monitored
23919:20170310:102759.073 no active checks on server [127.0.0.1:10051]: host [Zabbix server] not monitored
23919:20170310:102959.109 no active checks on server [127.0.0.1:10051]: host [Zabbix server] not monitored
23904:20170310:103011.545 Got signal [signal:15(SIGTERM),sender_pid:26144,sender_uid:0,reason:0]. Exiting ...
23904:20170310:103011.547 Zabbix Agent stopped. Zabbix 2.2.16 (revision 64243).
26157:20170310:103011.659 Starting Zabbix Agent [Zabbix server]. Zabbix 2.2.16 (revision 64243).
26157:20170310:103011.659 using configuration file: /etc/zabbix_agentd.conf
26168:20170310:103011.663 agent #1 started [listener #1]
26172:20170310:103011.663 agent #4 started [active checks #1]
26171:20170310:103011.663 agent #3 started [listener #3]
26170:20170310:103011.663 agent #2 started [listener #2]
26166:20170310:103011.664 agent #0 started [collector]
26172:20170310:103011.667 no active checks on server [127.0.0.1:10051]: host [Zabbix server] not monitored
通过查看日志,发现23919:20170310:092458.637 这条日志记录告诉我们说,主动从[127.0.0.1:10051]检查配置更新失败,agent与server之间的连接失败。
2.修改agent的配置文件,将ServerActive的地址改为zabbix-server的IP地址
[root@iZbp11rfoyeescusr9ha9qZ tmp]# vim /etc/zabbix/zabbix_agentd.conf
122 ServerActive=121.43.161.35
3.重启zabbix-agent服务,使得配置生效
[root@iZbp11rfoyeescusr9ha9qZ tmp]# /etc/init.d/zabbix-agentd restart
Shutting down Zabbix agent: [ OK ]
Starting Zabbix agent: [ OK ]
4.浏览器刷新页面,发现server端已经重新监控到agent运行状况的数据了
Tips:
- 在troubleshouting查看服务日志的时候,可以将注意力集中在有显示“fail”或者“Error”这类失败的关键词上,这样可以快速排错,找到问题的原因,而不必通篇阅读所有的日志,极大的提高效率。
- 作为运维工程师,脑袋储存的信息可能比较多、杂,时而出现忘记了某个服务、配置文件的绝对路径,如果记得文件或者目录的完整名,可以使用“locate+文件名”命令来定位文件的绝对路径,若是连文件名也记不大清了,没关系,还可以用Linux平台强大的搜索命令find,以全局查找的方式,通过星号来匹配到想要查找的文件的绝对路径,例如:find / -name *agentd.conf (从/目录开始,全局搜索以agentd结尾的.conf文件)。这些都是作为一名运维工程师应该具备的基本技能,而不必通过死记硬背的方式来记忆所有文件的绝对路径。
作者:MichaelLee
链接:https://www.jianshu.com/p/1fb78cdd5ea9
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。