escalations

Brian Andrus sysop at millenia.com
Thu Jul 15 16:24:16 CEST 2004


I am having trouble with the event handler. I have set up a test one for
vsftpd on the same box nagios is running on.
I created a restart-vsftpd script based on the http example to restart the
service (it is below).
I set up the command in the config and added the event_handler option to the
service (excerpts from the config files are below).

The even handler does get fired off three times when I down the service.
>From the log files, it gets called as CRITICAL SOFT 1, CRITICAL SOFT 2,
CRITICAL HARD 3 (at which point the script should actually do something).
The problem is that the script seems to call the /etc/rc.d/init.d/vsftpd
restart, but it exits after failing to shut it down. I get an entry in the
messages.log file "vsftpd: vsftpd shutdown failed" but I don't get the
startup succeeded message which I do get if I run "vsftpd restart" from the
command line.


Has anyone else seen this behaviour? I am running Fedora Core 1.

Excerpts:
--------------------------------
define command{
        command_name    restart-vsftpd
        command_line    /usr/lib/nagios/plugins/eventhandlers/restart-vsftpd
$SERVICESTATE$ $STATETYPE$ $SERVICEATTEMPT$
        }
 
define service{
        use                             generic-service         ; Name of
service template to use
        host_name                       rh1
        service_description             FTP
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              3
        event_handler                   restart-vsftpd
        normal_check_interval           5
        retry_check_interval            2
        contact_groups                  linux-admins
        notification_interval           240
        notification_period             24x7
        notification_options            w,u,c,r
        check_command                   check_ftp
        }
---------------------cut--------------------
#!/bin/sh
################## 
# Restart-vsftpd #
##################
Case "$1" in
OK)
        # The service just came back up, so don't do anything...
        ;;
WARNING)
        # We don't really care about warning states, since the service is
probably still running...
        ;;
UNKNOWN)
        # We don't know what might be causing an unknown error, so don't do
anything...
        ;;
CRITICAL)
        # Is this a "soft" or a "hard" state?
        case "$2" in

        # We're in a "soft" state, meaning that Nagios is in the middle of
retrying the
        # check before it turns into a "hard" state and contacts get
notified...
        SOFT)

                case "$3" in

                3)
                        echo -n "Restarting service (3rd soft critical
state)..."
                        /etc/rc.d/init.d/vsftpd restart
                        ;;
                        esac
                ;;

        HARD)
                echo -n "Restarting service..."
                /etc/rc.d/init.d/vsftpd restart
                ;;
        esac
        ;;
esac
exit 0
-------------cut-------------



 
All The Best,
 
Brian Andrus
Millenia Internet Services, Inc.
(310) 260-1514
http://www.millenia.com



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
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