Nagios没有遵循与check_httpredirect

目前进行testing我设置服务检查如下:

define service{ use generic-service host_name <host> service_description HTTP check_command check_http!-s "blablabla" -f follow } 

请注意,页面上不存在string“blablabla”,这仅仅用于testing。

Nagios正在报告

 HTTP OK: HTTP/1.1 301 Moved Permanently - 294 bytes in 6.607 second response time Performance Data: time=6.606636s;;;0.000000 size=294B;;;0 

但是,如果我直接运行check_http插件,我得到以下内容:

 <user>@<nagiosbox>:/usr/lib/nagios/plugins# ./check_http -H <host> -s "blablabla" -f follow HTTP CRITICAL: HTTP/1.1 200 OK - string 'blablabla' not found on 'http://<host>:80/' - 92654 bytes in 3.984 second response time |time=3.983636s;;;0.000000 size=92654B;;;0 

你确定你使用相同的参数调用同一个插件吗? 在我看来,你没有正确定义服务。 通常,parameter passing时没有选项,例如:

 check_command check_http!blablabla!follow 

他们是由! 。 在命令定义中,您可以指定check_http插件的正确选项,如:

 # 'check_http' command definition define command{ command_name check_http command_line /usr/lib/nagios/plugins/check_http -H '$HOSTADDRESS$' -s '$ARG1$' -f '$ARG2$' } 

参数$ARG1$$ARG2$将被您在服务定义中指定的实际值replace。