1、通過日誌排查問題:
位置: /usr/local/nagios/var/nagios.log
2、常見錯誤:
A、It appears as though you do not have permission to view information for any of the servies you requested
原因:打開IE登錄的nagios用戶無剛問權限
解決: vi cgi.cfg +119
authorized_for_system_information=admin
#把建立的用戶添加到後邊,注意用逗號隔開。
B、Return code of 127 is out of bounds - plugs may be missing
原因:可能因爲缺少插件。在command.cfg裏未定義或者定義了實際不存在的插件。
解決:檢查服務端和客戶端的/usr/local/nagios/libexec
檢查 ll /usr/local/nagios/libexec/ 目錄是否有services.cfg裏使用的插件。
C、CHECK_NRPE:Errdr -Could not complete SSl handshake 錯誤。
原因:一般爲客戶端nrpe權限問題
解決: vi /usr/local/nagios/etc/nrpe.cfg +79
allowed_hosts=10.0.0.22,127.0.0.1
重啓: pkill nrpe
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
D、Timeout while attempting connection |Connection refused or time out
原因:防火牆阻擋或者nrpe服務爲開啓
解決:/etc/init.d/iptables stop
E、Internal Server Error 錯誤
原因:selinux 導致
解決: vi /etc/selinux/config
修改SELINUX項爲disabled
F、CRITICAL -Socket timeout after 31 secouds
原因:網絡故障、服務器拒絕連接或防火牆問題
E、NRPE: Unable to read output
原因:被動模式客戶端腳本沒有執行權限:
解決: chmod 644 xx
F、NRPE :Command 'check_iostat' not defined
原因:插件未定義
解決:客戶端,nrpe的命令名定義不正確,導致服務端check_nrpe無法獲取爭取的命令名
服務端,service.cfg 裏的check_nrpe!check_iostt
提醒:
a、檢查客戶端系統自帶的防火牆,是否把nrpe默認端口5666 drop掉
b、把nrpe log打開,可以發現更多有用的信息
c、nrpe 添加完命令,有沒有真正的重啓 !很重要。