How to change the Service Check Status Qualification

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dyglys
Posts: 7
Joined: Sat Dec 30, 2017 3:10 pm

How to change the Service Check Status Qualification

Post 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
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: How to change the Service Check Status Qualification

Post 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.
Former Nagios employee
https://www.mcapra.com/
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: How to change the Service Check Status Qualification

Post by dwhitfield »

Thanks @mcapra!

Another option would be to use the negate plugin: https://assets.nagios.com/downloads/nag ... ios-XI.pdf
dyglys
Posts: 7
Joined: Sat Dec 30, 2017 3:10 pm

Re: How to change the Service Check Status Qualification

Post 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
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: How to change the Service Check Status Qualification

Post by dwhitfield »

Did you have any other questions, or are we ready to lock this up?
dyglys
Posts: 7
Joined: Sat Dec 30, 2017 3:10 pm

Re: How to change the Service Check Status Qualification

Post 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
Locked