event handler help

Jack Coates jack at monkeynoodle.org
Mon Dec 15 17:00:46 CET 2003


Hi all,

I'm trying to set up an event handler to restart a DSL modem via X10.
I've followed the documentation closely, but I have two problems:

1) it waited seven hours before even attempting to run the script.

define service{
        use                             generic-service
        host_name                       gw201
        service_description             PING
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              5
        event_handler                   restart_dsl_modem
        normal_check_interval           10
        retry_check_interval            5
        contact_groups                  admins
        notification_interval           120
        notification_period             24x7
        notification_options            w,u,c,r
        check_command                   check_ping!100.0,40%!500.0,80%
        }

2) when it ran the script, the script felt that the state wasn't hard
enough and quietly bailed.

cat /usr/lib/nagios/plugins/modem-cycle.sh | grep -v \#

case "$1" in
OK)
        ;;
WARNING)
        ;;
UNKNOWN)
        ;;
CRITICAL)
        case "$2" in
        SOFT)
                case "$3" in
                3)
                        echo -n "Restarting DSL modem (3rd soft critical
state)..."
                        /usr/bin/br -x /dev/ttyS1 -r=3 --off=7
                        logger "DSL modem has been powered off (3 soft
criticals)"
                        sleep 10
                        /usr/bin/br -x /dev/ttyS1 -r=3 --on=7
                        logger "DSL modem has been powered on"
                        ;;
                        esac
                ;;      
        HARD)
                echo -n "Restarting DSL modem (hard critical state)..."
                /usr/bin/br -x /dev/ttyS1 -r=3 --off=7
                logger "DSL modem has been powered off (hard critical)"
                sleep 10
                /usr/bin/br -x /dev/ttyS1 -r=3 --on=7
                logger "DSL modem has been powered on"
                ;;
        esac
        ;;
esac
exit 0

I've upped the timeout and packet loss defaults on that check_ping
because I use traffic shaping and don't want this being triggered just
because the bandwidth is being used (I've had a lot of false positives
caused by check_ping's ICMP being deprioritized). 

Any ideas? Thanks in advance,
--
Jack at Monkeynoodle Dot Org: It's A Scientific Venture...
**********************************************************************
* "You guys! Don't use your toothbrushes in experiments!" -- Mom     *
**********************************************************************



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Nagios-users mailing list
Nagios-users at 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





More information about the Users mailing list