Page 1 of 1

Check of HTTPS reply content

Posted: Fri Sep 23, 2016 10:09 am
by sth_bytelab
Hi
Is it possible to check if the content of a HTTPS reply contains a special string?
Can I do this through the check_http command?
Thanks
/Simon

Re: Check of HTTPS reply content

Posted: Fri Sep 23, 2016 10:53 am
by rkennedy
Which part of the 'reply' are you looking for a special string? If it's the actual page, you should be able to use -r or -R to match regex on the page -

Code: Select all

 -r, --regex, --ereg=STRING
    Search page for regex STRING
 -R, --eregi=STRING
    Search page for case-insensitive regex STRING

Re: Check of HTTPS reply content

Posted: Sun Sep 25, 2016 8:51 am
by sth_bytelab
I would like to see if th envelope of the response contains: "AuthenticateTokenResult i:nil="true"".

Re: Check of HTTPS reply content

Posted: Mon Sep 26, 2016 12:43 pm
by rkennedy
You might be able to use this check_http with the -d flag -

Code: Select all

 -d, --header-string=STRING
    String to expect in the response headers
I haven't tested it, but I believe what you're looking for is sent in the headers.

Re: Check of HTTPS reply content

Posted: Thu Sep 29, 2016 6:02 am
by sth_bytelab
The solution is to use the check_http with a twist. I used it to check a SOAPAction using this as arguments,
H hostname -S -k SOAPAction:NameOfAction' -r 'ExpectedResult' -T application/soap+xml -P 'HTTP envelope' -t 10 -m 512 -f ok -I IP-adresse -u 'service' -S -p 443

But I trying to do the same but this time I am having another problem because the Action return HTTP code 500. This is alright but how do I get Nagios to acknowledge this HTTP response?

Re: Check of HTTPS reply content

Posted: Thu Sep 29, 2016 12:24 pm
by rkennedy
If that's the case, then use -e to expect a specific HTTP resposne.

For example -

Code: Select all

[root@localhost libexec]# ./check_http -H google.com -e 301
HTTP OK: Status line output matched "301" - 559 bytes in 0.104 second response time |time=0.103633s;;;0.000000 size=559B;;;0