目前为了测试,我将服务检查设置如下:
define service{
use generic-service
host_name <host>
service_description HTTP
check_command check_http!-s "blablabla" -f follow
}
Run Code Online (Sandbox Code Playgroud)
请注意,页面上不存在字符串“blablabla”,这仅用于测试。
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
Run Code Online (Sandbox Code Playgroud)
但是,如果我直接运行 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
Run Code Online (Sandbox Code Playgroud) nagios ×1