nagios的 Status Information 不更新
本帖最后由 frontad 于 2014-05-21 14:54 编辑我下了个check_nginx,在nagios里配置完成后一直不能更新状态信息(图中红圈内的值)。请各位大侠帮忙看看,非常感谢!
services.cfg的配置
define service{
use local-service
host_name VSVR7B03
service_description nginx_status
check_command check_nginx!www.firstshare.cn!/nginx_status/!4000!5000
}
commands.cfg的配置
# check nginx
define command{
command_name check_nginx
command_line $USER1$/check_nginx.sh -u $ARG1$ -p $ARG2$ -w $ARG3$ -c $ARG4$
}
hosts.cfg的配置
define host{
use linux-server
host_name VSVR7B03
alias VSVR7B03
address 192.168.0.73
} 直接在shell里运行,看看结果 回复 2# r2007
直接运行没有问题
./check_nginx.sh -u www.firstshare.cn -p /nginx_status/ -w 4000 -c 5000
OK - ActiveConn: 10 ,serveraccepts:94732,handled:94732,requests:1044334,reading:0,writing:1,waiting:9|'ActiveConn'= 10 ,'serveraccepts'=94732,'handled'=94732,'requests'=1044334,'reading'=0,'writing'=1,'waiting'=9
现在nagios显示的状态信息都是我手工运行后获得的
我不手工运行nagios就不更新nginx的状态信息
local-service怎么定义的?想看看。 回复 4# r2007
define service{
name local-service ; The name of this service template
use generic-service ; Inherit default values from the generic-service definition
max_check_attempts 4 ; Re-check the service up to 4 times in order to determine its final (hard) state
normal_check_interval 3 ; Check the service every 5 minutes under normal conditions
retry_check_interval 1 ; Re-check the service every minute until a hard state can be determined
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
} 很干净。
那么check_nginx.sh的文件属主用户和组是不是不对?落实一下吧,能想到的就这么多了 -rwxr-xr-x 1 nagios nagios 3793 May 21 11:59 check_nginx.sh
这些配置我已经过了好几遍了,可是就是不能找出问题相当头疼
nagios的日志文件也没有执行相应命令的记录,真的是快疯了 command_line $USER1$/check_nginx.sh -u $ARG1$ -p $ARG2$ -w $ARG3$ -c $ARG4$
将user1换成绝对路径
没看到哪里有user1 回复 8# r2007
这个在resource.cfg里定义的
# Sets $USER1$ to be the path to the plugins
$USER1$=/usr/local/nagios/libexec
将command_line改成/bin/bash -c 'echo OK':curse::curse::curse:
try1try
页:
[1]
2