Problems running eventhandler

Nicole Hähnel ml at nicole-haehnel.de
Tue Aug 5 15:38:48 CEST 2008


Hi,

I'm running nagios 3.0.3 on rhel5 2.6.18-92.1.6.el5.
I have written a script to restart strongswan on our vpn gateways.
But I can not get this eventhandler to work.
I only see (null);(null);(null); in eventlog instead of CRITICAL;SOFT;3 
oder something else.

I tested the script as user nagios and it works.

Where is the fault?

Thanks!
Nicole


EventLog:
[05-08-2008 15:25:38] SERVICE EVENT HANDLER: 
VPN-GW;IPSEC;(null);(null);(null);restart-ipsec


define command{
        command_name    restart-ipsec
        command_line    
/usr/lib64/nagios/plugins/eventhandlers/restart_ipsec.sh $SERVICESTATE$ 
$SERVICESTATETYPE$ $SERVICEATTEMPT$ $HOSTADDRESS$
        }

define service{
        use                             generic-service         ; Name 
of service template to use
        host_name                       VPN-GW
        service_description             IPSEC
        check_command                   check_tunnel!16
        event_handler_enabled           1
        event_handler                   restart-ipsec
        }

restart_ipsec.sh:

#!/bin/sh

case "$1" in
OK)
        #
        ;;
WARNING)
        #
        ;;
UNKNOWN)
        #
        ;;
CRITICAL)
        case "$2" in

        SOFT)
                case "$3" in

                3)
                        echo -n "Restarting IPSEC service (3rd soft 
critical state)..."
                        ssh -i id_dsa $4 "/etc/init.d/ipsec restart"
                        ;;
                        esac
                ;;
        HARD)
                echo -n "Restarting IPSEC service..."
                ssh -i id_dsa $4 "/etc/init.d/ipsec restart"
                ;;
        esac
        ;;
esac
exit 0

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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