Hi,
I'm trying to differentiate in my event handler script between a recover
from a critical state and one from an unknown state.
I need to run a script upon a recovery, but only a recovery from a
critical hard state?
Is there a way to do this?

Nagios: Version 1.2


>From config files:

event_handler           remote-event-handler-sc4-test

define command{
        command_name    remote-event-handler-sc4-test
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c 
remote-event-handler-sc4-test -a "$SERVICESTATE$ $STATETYPE$ $SERVICEATTEMPT$"
}



>From my log files:

Thu Aug  9 11:45:52 EST 
2007|/usr/local/nagios/libexec/test_event|UNKNOWN|SOFT|1|| 
Thu Aug  9 11:46:52 EST 
2007|/usr/local/nagios/libexec/test_event|UNKNOWN|SOFT|2|| 
Thu Aug  9 11:47:52 EST 
2007|/usr/local/nagios/libexec/test_event|UNKNOWN|SOFT|3|| 
Thu Aug  9 11:48:52 EST 
2007|/usr/local/nagios/libexec/test_event|UNKNOWN|HARD|4|| 
Thu Aug  9 11:50:52 EST 
2007|/usr/local/nagios/libexec/test_event|OK|HARD|4|Recovery Detected. 
Re-direct modems back to original site:|


Thu Aug  9 11:08:52 EST 
2007|/usr/local/nagios/libexec/test_event|CRITICAL|SOFT|1|| 
Thu Aug  9 11:09:52 EST 
2007|/usr/local/nagios/libexec/test_event|CRITICAL|SOFT|2|| 
Thu Aug  9 11:10:53 EST 
2007|/usr/local/nagios/libexec/test_event|CRITICAL|SOFT|3|| 
Thu Aug  9 11:15:32 EST 
2007|/usr/local/nagios/libexec/test_event|CRITICAL|HARD|4|Taking Action. 
Redirect faxes|
Thu Aug  9 11:20:32 EST 
2007|/usr/local/nagios/libexec/test_event|OK|HARD|4|Recovery Detected. 
Re-direct modems back to original site:|





Part of the Event Script:


# What state is the service in?
case "$1" in
OK)
        
        case "$2" in    
        SOFT)
                echo "OK"
                echo "`date`Soft OK state. Do nothing:$VARLOGGED" >> $LOGFILE 
                

        ;;

        HARD)   
                        case "$3" in
                        4)
                                echo "OK"
                                echo "`date`Recovery Detected. Re-direct modems 
back to original site:$VARLOGGED" >> $LOGFILE 
                                ;;
                        
                        *)      
                                echo "OK"
                                echo "`date` Recovery Detected, Hard OK, 
Unknown state, Do nothing:$VARLOGGED" >> $LOGFILE 
                                ;;
                                

                        esac
        ;;
                
        *)
                        echo "OK"
                        echo "`date`|$1|$2|$3| OK but Unknown state, Do 
nothing:$VARLOGGED" >> $LOGFILE 
                        ;;
                        

        esac
        ;;


WARNING)
        # We don't really care about warning states, since the service is 
probably still running...
        echo "WARNING"
        exit 0
        ;;
UNKNOWN)
        # We don't know what might be causing an unknown error, so don't do 
anything...
        echo "UNKNOWN"
        exit $STATE_OK
        ;;






Attention:
The information contained in this message and or attachments is intended only 
for the person or entity to which it is addressed and may contain confidential 
and/or privileged material.  Any review, retransmission, dissemination or other 
use of, or taking of any action in reliance upon, this information by persons 
or entities other than the intended recipient is prohibited. If you received 
this in error, please contact the sender and delete the material from any 
system and destroy any copies.

Any views expressed in this message are those of the individual sender and may 
not necessarily reflect the views of The Gribbles Group.

Thank You.

Whilst every effort has been made to ensure that this e-mail message and any 
attachments are free from viruses, you should scan this message and any 
attachments.
Under no circumstances do we accept liability for any loss or damage which may 
result from your receipt of this message or any attachment.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to