Page 1 of 1

Notification if not critical

Posted: Fri Nov 02, 2012 12:01 pm
by gshergill
Hi Nagios Community,

I was wondering if it is possible to reverse the notification method, in the sense that if the service is NOT critical (aka, it's OK), send an email.

This might seem a bit random, but for NSClient++, using check_nt, explorer.exe is OK if someone is logged in. If no one is logged into the server, it returns critical.

Ideally, we want to know if someone IS logged in, as it is the AD server being monitored and access is very restricted.

My plan was to use the RECOVERY SERVICE ALERT - So it only sends a notificaiton once when critical, then when someone logs in (no longer critical), it will say it has recovered.

Was wondering if that's the only way? Or is there is functionality in Nagios to do the reverse order?

Thank you.

Kind Regards,

Gary Shergill

Re: Notification if not critical

Posted: Fri Nov 02, 2012 1:03 pm
by scottwilkerson
gshergill wrote:Or is there is functionality in Nagios to do the reverse order?
I would make a new command using the negate plugin.

Here's some discussion about it
http://support.nagios.com/forum/viewtop ... 259#p34157

Code: Select all

[root@localhost libexec]# ./negate -h
negate v1989 (nagios-plugins 1.4.13)
Copyright (c) 2002-2008 Nagios Plugin Development Team
        <[email protected]>

Negates the status of a plugin (returns OK for CRITICAL and vice-versa).
Additional switches can be used to control which state becomes what.


Usage:negate [-t timeout] [-owcu STATE] [-s] <definition of wrapped plugin>

Options:
 -h, --help
    Print detailed help screen
 -V, --version
    Print version information
 -t, --timeout=INTEGER
    Seconds before connection times out (default: 11)
    Keep timeout longer than the plugin timeout to retain CRITICAL status.
 -o, --ok=STATUS
 -w, --warning=STATUS
 -c, --critical=STATUS
 -u, --unknown=STATUS
    STATUS can be 'OK', 'WARNING', 'CRITICAL' or 'UNKNOWN' without single
    quotes. Numeric values are accepted. If nothing is specified, permutes
    OK and CRITICAL.
 -s, --substitute
    Substitute output text as well. Will only substitute text in CAPITALS

Examples:
 negate /usr/local/nagios/libexec/check_ping -H host
    Run check_ping and invert result. Must use full path to plugin
 negate -w OK -c UNKNOWN /usr/local/nagios/libexec/check_procs -a 'vi negate.c'
    This will return OK instead of WARNING and UNKNOWN instead of CRITICAL

Notes:
 This plugin is a wrapper to take the output of another plugin and invert it.
 The full path of the plugin must be provided.
 If the wrapped plugin returns OK, the wrapper will return CRITICAL.
 If the wrapped plugin returns CRITICAL, the wrapper will return OK.
 Otherwise, the output state of the wrapped plugin is unchanged.

Re: Notification if not critical

Posted: Mon Nov 05, 2012 5:05 am
by gshergill
Hi scottwilkerson,
scottwilkerson wrote:I would make a new command using the negate plugin.
That's perfect! Thank you.

Kind Regards,

Gary Shergill