Page 1 of 1

How to change the Service Check Status Qualification

Posted: Wed Jan 03, 2018 7:37 am
by dyglys
Hi,

our business requirements are: to check if connection to web server is not possible, i.e. if connection is forbidden, the result is "OK", if connection is possible, the results is "Critical".

Nagios XI HTTP Service check gives the result:
Status: Warning
Status information: HTTP WARNING: HTTP/1.1 403 Forbidden - 5179 bytes in 0.003 second response time
Which is very good for our business result but is qualified being "Warning" for Nagios XI Stats.

My Question: How to switchover the check status qualification result and represent the result being:
Status: Ok
Status information: HTTP WARNING: HTTP/1.1 403 Forbidden - 5179 bytes in 0.003 second response time

Thank you for your ideas very much.
dyglys

Re: How to change the Service Check Status Qualification

Posted: Wed Jan 03, 2018 10:00 am
by mcapra
I believe check_http is the underlying Nagios plugin for that. Here's the man page:
https://nagios-plugins.org/doc/man/check_http.html

This argument might be of particular interest to you:

Code: Select all

     -e, --expect=STRING
        Comma-delimited list of strings, at least one of them is expected in
        the first (status) line of the server response (default: HTTP/1.)
        If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)
Here's a similar topic covering HTTP response codes:
https://support.nagios.com/forum/viewto ... 16&t=46804

I would think something like this should work:

Code: Select all

/usr/local/nagios/libexec/check_http -H www.google.com -j HEAD --expect=403
You should be able to change the service in the Core Config Manager and append --expect=403 to the proper $ARGn$ value.

I think the website configuration wizard also has some fields for the expected response code/test if you wanted to do it that way.

Re: How to change the Service Check Status Qualification

Posted: Wed Jan 03, 2018 11:34 am
by dwhitfield
Thanks @mcapra!

Another option would be to use the negate plugin: https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Re: How to change the Service Check Status Qualification

Posted: Wed Jan 03, 2018 1:25 pm
by dyglys
Hi,
this is exactly I was looking for

Nagios XI CCM
Check Command=check_http
is performing command=$USER1$/check_http -I $HOSTADDRESS$ $ARG1$
$ARG1$=--expect=403

Result=HTTP OK: Status line output matched "403" - 381 bytes in 0.006 second response time

Great !
Thank you for swift support.
dyglys

Re: How to change the Service Check Status Qualification

Posted: Wed Jan 03, 2018 1:53 pm
by dwhitfield
Did you have any other questions, or are we ready to lock this up?

Re: How to change the Service Check Status Qualification

Posted: Thu Jan 04, 2018 1:51 am
by dyglys
Hi, dwhitfield.

Negate plugin is a perfect option, I foresee nice use of it.

Let us us consider the tread being closed.

Thank you.
dyglys