Zabbix agent on Zabbix server is unreachable for 5 minutes


主機運行時,會報這個錯,所以要先按安裝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:

  1. 在troubleshouting查看服務日誌的時候,可以將注意力集中在有顯示“fail”或者“Error”這類失敗的關鍵詞上,這樣可以快速排錯,找到問題的原因,而不必通篇閱讀所有的日誌,極大的提高效率。
  2. 作爲運維工程師,腦袋儲存的信息可能比較多、雜,時而出現忘記了某個服務、配置文件的絕對路徑,如果記得文件或者目錄的完整名,可以使用“locate+文件名”命令來定位文件的絕對路徑,若是連文件名也記不大清了,沒關係,還可以用Linux平臺強大的搜索命令find,以全局查找的方式,通過星號來匹配到想要查找的文件的絕對路徑,例如:find / -name *agentd.conf (從/目錄開始,全局搜索以agentd結尾的.conf文件)。這些都是作爲一名運維工程師應該具備的基本技能,而不必通過死記硬背的方式來記憶所有文件的絕對路徑。


作者:MichaelLee
鏈接:https://www.jianshu.com/p/1fb78cdd5ea9
來源:簡書
著作權歸作者所有。商業轉載請聯繫作者獲得授權,非商業轉載請註明出處。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章