I'm at home now (20.33) so I will give it another go in the morning.
Thank you for your continuing patience!
Pete
Code: Select all
define command{
command_name check_http_url
command_line $USER1$/check_http -H $HOSTADDRESS$ -u $ARG1$
}
define host{
host_name URL1
hostgroups 000-URL1
address MYURL
max_check_attempts 5
check_period 24x7
contact_groups admins
notification_period 24x7
}
define service{
use generic-service
host_name URL1
service_description -
check_command check_http_url!URL1/my/url/name
}
Code: Select all
define service{
use generic-service
service_description
check_command check_http_url!/my/url/path/ --expect=301 -w "Clear settings Cache"
host_name URL1
}
Can you post your service definition once again? It doesn't look proper, and I'm unsure how it's working since you're not passing -s / -r at all. It appears your passing your string matching in the -w field, which won't work.-w, --warning=DOUBLE
Response time to result in warning status (seconds)
Code: Select all
./check_http -H MyURL -u /my/url/path -s "This document may be found" -v
Code: Select all
GET /members/lp/system HTTP/1.1
User-Agent: check_http/v2.0 (nagios-plugins 2.0)
Connection: close
Host: MyURL
MyURL:80/my/url/path is 445 characters
STATUS: HTTP/1.1 301 Moved Permanently
**** HEADER ****
Content-Type: text/html; charset=UTF-8
Location: http://MyURL/my/url/path/
Date: Thu, 04 Aug 2016 15:44:21 GMT
Content-Length: 171
NS-LB-VSERVER: lb=010-MDN-Members:DotNET-8003#DEV
NS-ORIGIN-SERVER: 99.99.99.99
**** CONTENT ****
<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This document may be found <a HREF="http://MyURL/my/url/path/">here</a></body>
Code: Select all
HTTP OK: HTTP/1.1 301 Moved Permanently - 445 bytes in 0.004 second response time |time=0.003540s;;;0.000000 size=445B;;;0
Code: Select all
define service{
use generic-service
service_description
check_command check_http_url!/my/url/path/ -s "[color=#FF0000]This document may be found[/color]" --expect=200
host_name URL1
}
Code: Select all
[color=#FF0000]HTTP CRITICAL: Status line output matched "200" - string 'This document may be found' not found on 'http://MyURL:80/my/url/path/' - 374 bytes in 0.011 second response time[/color]
Code: Select all
[root@localhost libexec]# ./check_http -H google.com
HTTP OK: HTTP/1.1 301 Moved Permanently - 559 bytes in 0.114 second response time |time=0.113783s;;;0.000000 size=559B;;;0
[root@localhost libexec]# curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
Code: Select all
[root@localhost libexec]# ./check_http -H google.com --expect=200
HTTP CRITICAL - Invalid HTTP response received from host: HTTP/1.1 301 Moved Permanently
Code: Select all
[root@localhost libexec]# ./check_http -H google.com --expect=200 -s "The document has moved"
HTTP CRITICAL - Invalid HTTP response received from host: HTTP/1.1 301 Moved Permanently
Code: Select all
[root@localhost libexec]# ./check_http -H google.com --expect=301 -s "The document has moved"
HTTP OK: Status line output matched "301" - 559 bytes in 0.066 second response time |time=0.066209s;;;0.000000 size=559B;;;0