天天看點

nagios安裝教程 錯誤解析 注意事項

原文:http://www.weiruoyu.cn/?p=748

http://yahoon.blog.51cto.com/13184/41893

我采用的是:nagios-cn-3.2.3這個版本,是以有些檔案地方不太一樣,要根據實際需要進行修改,但是會出現如下錯誤

按照yahoon的教程去安裝,注意紅色字型要進行相應修改,這是版本更新帶來的改變。

[root@bogon objects]# vi contacts.cfg

define contact{

contact_name nagios

alias sys admin

service_notification_period 24x7

host_notification_period 24x7

service_notification_options w,u,c,r

host_notification_options d,u,r

service_notification_commands notify-service-by-email

host_notification_commands notify-host-by-email

email [email protected]

pager 1511027****

}

nagios常用指令:

1.檢查nagios配置檔案是否有問題

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

排錯:(機器是centos5.5)

1.不識别xinetd服務

service xinetd restart

不識别xinetd

服務

就yum安裝:

  1. [root@localhost ~]# yum -y install xinetd

2.如果報錯:

Another app is currently holding the yum lock; waiting for it to exit...

The other application is: yum-updatesd-he

因為yum被鎖定了,

運作這個指令即可

  1. [root@localhost ~]# rm -f /var/run/yum.pid

3.報錯:

CHECK_NRPE: Error - Could not complete SSL handshake.

解決辦法:

[root@localhost ~]# yum install openssl-devel

檢查:vi /etc/xinetd.d/nrpe 檔案

only_from = 127.0.0.1 124.205.226.124

這個是否有空格。

./check_nt -H 123.196.114.68 -p12489 -v UPTIME

備注:

監控linux,測試是否連通,在windows機器上安裝後,在監控伺服器端輸入指令

測試是否可以連通:(-H後面是監控伺服器的IP)

[root@localhost libexec]# ./check_nt -H 113.143.***.*** -p12489 -v CLIENTVERSION

[root@localhost libexec]# ./check_nt -H 113.143.***.*** -p12489 -v UPTIME

來測試是否可以連通。

4.nagios登陸報錯

Authorization Required

his server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.

檢視httpd.conf檔案最下面的路徑是否正确

正确路徑應該是:

AuthUserFile /usr/local/nagios/etc/htpasswd.users

有2個這個路徑。

修改後重新啟動,httpd和nagios都要重新開機。

如果還不行,分析如下問題:

檢視配置檔案

vi /etc/httpd/conf.d/nagios.conf

cd /usr/local/nagios/etc

檢視檔案,原來這個.users檔案的權限是root,可能apache通路不了喲。修改下試試

-rw-r--r-- 1 root root 26 12月 23 15:51 htpasswd.users

檢視apache日志

cd /var/log/httpd

tail -f error_log,登陸的時候報錯如下:

[Wed Dec 23 16:22:38 2009] [error] [client 10.206.19.254] (13)Permission denied: Could not open password file: /usr/local/nagios/etc/htpasswd.users

網上說是selinux的原因,于是我做如下操作關閉selinux

指令:setenforce 0

再次通路就OK了,可以正常登陸,但是點選某些頁面時有如下提示:

It appears as though you do not have permission to view information for any of the hosts you requested...

vi /usr/local/nagios/etc/cgi.cfg

修改use_authentication=1為use_authentication=0

service nagios restart 重新開機後就OKl了:)

以上摘自:http://sillycat.iteye.com/blog/562659

http://sookk8.blog.51cto.com/455855/d-2

繼續閱讀