nagios监控配置错误汇总

 agios监控配置错误汇总

1.check_iftraffic监控网卡流量的配置及错误解决办法

服务端:

添加以下内容:

vim /usr/local/nagios/etc/objects/commands.cfg

#check iftraffic
define command{
        command_name    check_iftraffic
        command_line    $USER1$/check_iftraffic -H $HOSTADDRESS$ -i $ARG1$ -w $ARG2$ -c $ARG3$ -b $ARG4$ -u $ARG5$
}

vim /usr/local/nagios/etc/objects/62xxx.cfg

define service{
        use                             local-service
        host_name                       62xxx
        service_description             网卡流量
        check_command                   check_nrpe!check_iftraffic!"eth0"!50!100!100!m
        notifications_enabled           0
}

监控客户端:

vim /usr/local/nagios/etc/nrpe.cfg

command[check_iftraffic]=/usr/local/nagios/libexec/check_iftraffic_nrpe.pl -i eth0 -w 50 -c 100 -b 100 -u m

重启服务后,nagios监控页面提示UNKNOWN,NRPE: Unable to read output 
解决办法:在监控客户端执行  /usr/local/nagios/libexec/check_iftraffic_nrpe.pl -i eth0 -w 50 -c 100 -b 100 -u m 

然后会在 /tmp 下面 生成一个文件 ls /tmp/ traffic_ifeth0 修改traffic_ifeth0的所属权限 chown nagios.nagios /tmp/traffic_ifeth0 -R

这样问题就OK了!

2.nagios错误日志里面 tailf /var/log/message提示

Aug 14 12:38:07 tsts-57 nagios: Warning: The check of service '交换空间利用率' on host 'localhost' looks like it was orphaned (results never came back).  I'm scheduling an immediate check of the service...
Aug 14 12:38:07 tsts-57 nagios: Warning: The check of service '系统负荷' on host 'localhost' looks like it was orphaned (results never came back).  I'm scheduling an immediate check of the service...
Aug 14 12:38:18 tsts-57 nagios: Warning: The check of service 'PING' on host '69nginx' looks like it was orphaned (results never came back).  I'm scheduling an immediate check of the service...
。。。。。。等等吧

这个错误是因为nagios多进程引起的,你可以ps -ef | grep nagios 发现有多个进程,把他们全部杀掉,然后重启 /etc/init.d/nagios start ,问题就OK了!

nagios启用通知提示错误:“ 无法打开要更新的命令文件,外部命令文件或目录权限不对,参考FAQ设置正确的权限”

用chmod o+w nagios.cmd即prw-rw--w- 1 nagios nagios 0 Jun 17 12:56 nagios.cmd可以正常关闭开启报警。
Nagios另外一种情况:
/usr/loca/nagios/var/rw/下面没有nagios.cmd文件。
这时需手工创建该文件,因为也无法从别的nagios下复制过来,我试过复制,但提示这不是一个普通的文件,复制失败,文件大小为0。这时用命名管道由命令  mkfifo创建一个文件。
mkfifo   nagios.cmd
创建之后文件默认属性为prw-r--r--
更改其所属用户与组都为nagios。 
chown –R nagios:nagios    /usr/local/nagios/var/rw/nagios. cmd
尝试使用外部命令时候还会出现权限错误,这时再给其他用户写权限。即为prw-rw--w--

 

 

解决办法:

更改/usr/local/nagios/var/rw/nagios.cmd的文件权限之前为
prw-rw---- 1 nagios nagios 0 Jun 17 12:56 nagios.cmd  

你可能感兴趣的:(监控)