Page 1 of 1

How to ignore Unkown state and return previous state?

Posted: Wed Sep 25, 2013 1:04 pm
by kiklop
Hi,
Maybe a stupid question and I missed something.. But I have a problem with my environment..

look a this log:

Code: Select all

2013/09/23	21:30:56	WS00001	Dell_Storage	WARNING	NOTIF	Controller 0 [PERC H710 Mini]: Firmware 21.1.0-0007 is out of date
2013/09/23	21:30:56	WS00001	Dell_Storage	WARNING	HARD	Controller 0 [PERC H710 Mini]: Firmware '21.1.0-0007' is out of date
2013/09/23	20:59:55	WS00001	Dell_Storage	UNKNOWN	HARD	SNMP UNKNOWN: No response from remote host '10.42.8.241'		
2013/09/23	20:44:35	WS00001	Dell_Storage	WARNING	NOTIF	Controller 0 [PERC H710 Mini]: Firmware 21.1.0-0007 is out of date
2013/09/23	20:44:35	WS00001	Dell_Storage	WARNING	HARD	Controller 0 [PERC H710 Mini]: Firmware '21.1.0-0007' is out of date
Service was in WARN state, then probably because of short network outage plugin didnt receive a response and the result was Hard Unknown state (without notification). Next check was successfull and I received a new notification but the state is still the same.. So in this case nothing new happend and I received new notification. Notification in this case is sent only for W, C.


So, Is it possible to tell nagios that if plugin returns an Unkown state, nagios will use the previous state? (Ok, Warn, Crit). So simply, I want to ignore Unkown state and want to avoid changing states..

Can I use events, macros or something like this? I know only about one solution.. create a script and put it between nagios and plugins. But I think that it`s too complicated and I hope that nagios offers a solution for this ;)

Re: How to ignore Unkown state and return previous state?

Posted: Wed Sep 25, 2013 3:28 pm
by abrist
You could use the negate plugin to force unknowns to register as criticals:

Code: Select all

/usr/local/nagios/libexec/negate --help

Code: Select all

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.

Send email to [email protected] if you have questions
regarding use of this software. To submit patches or suggest improvements,
send email to [email protected]