[Nagiosplug-devel] Boolean Plugins

Matthias Flacke Matthias.Flacke at gmx.de
Fri Jun 13 19:43:07 CEST 2008



Dylan Martin wrote:
> I'm wondering if there is a way to have the status of a host or
> service depend on multiple checks?  For example, I have two ways of
> checking if a server is up and they're both prone to false-negatives
> (negative == down in this case).  I'd like to have the host status be
> UP if either of these tests returns OK.
> 
> I was thinking of how to do that, and I realised what I want is really
> a form of logical OR, and there are definitely applications for a
> logical AND, and finally there's already a NOT (negate).  So, I'm
> thinking of making check_and and check_or.
> 
> I've found check_multi, but I'm in nagios 2.
> 
> Has someone already done this?  Is there a mechanism that does this
> already?  Does this sound like a good idea?

check_multi with the report option (-r 512) also works fine under Nagios 2, 
the output then is compressed to one line.

But I assume that you mainly need the status logic and this is not depending 
on the Nagios version ;-).

You can build complex boolean expressions in Perl syntax like

state[CRITICAL]=((check_a == OK) || (check_b > check_c)) && !check_d

Pattern regex against plugin outputs is also available:

state[CRITICAL]=$check_a$ !~ /error|failed/

HTH - Matthias




More information about the Devel mailing list