Page 1 of 1

URL monitoring with execultion for a range of value

Posted: Tue Dec 19, 2017 3:33 pm
by naranant
Hello,

I have the requirement to monitor the URL with the authentication and need to ignore the alerts for the range from 2XX to 3XX. Need help in defining the same. Currently, i could define for only one range i.e. 200. Below is command line i have used.


Check_xi_service_http! -f ok -I xxx.xx.xxx.xxx -u '/' -S -p 443 -a 'xxxxxx:xxxxx' --expect=200!!!!!!!

Below is the output

HTTP CRITICAL - Invalid HTTP response received from host on port 443: HTTP/1.1 302 Found

Re: URL monitoring with execultion for a range of value

Posted: Tue Dec 19, 2017 4:11 pm
by mcapra
I'd imagine the list of valid response codes is short enough that one could hard-code them:

Code: Select all

/usr/local/nagios/libexec/check_http -H www.google.com -j HEAD --expect=200,201,202,203,204,205,206,207,208,226,300,301,302,303,304,305,306,307,308
This would effectively return a CRITICAL for any 4xx/5xx codes unless the HTTP server is returning some crazy custom response codes. For a more elegant solution, I think check_http would need to be altered. Feel free to submit a GitHub issue to see that happen:
https://github.com/nagios-plugins/nagios-plugins

Re: URL monitoring with execultion for a range of value

Posted: Tue Dec 19, 2017 4:17 pm
by npolovenko
Thanks, @mcapra.
@naranant, Let us know if you have any other questions for us.

Re: URL monitoring with execultion for a range of value

Posted: Tue Dec 26, 2017 2:26 pm
by naranant
Thanks, @mcapra.

It worked...

Re: URL monitoring with execultion for a range of value

Posted: Wed Dec 27, 2017 10:41 am
by tmcdonald
Glad to hear it! I'll be closing this thread now, but feel free to open another if you need anything in the future.