原文: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安装:
[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被锁定了,
运行这个命令即可
[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
http://liyaoyi.blog.51cto.com/442933/847222 还没有测试
http://dl528888.blog.51cto.com/2382721/763032 还没有测试