Event Handlers

Marc Powell marc at ena.com
Fri Jan 19 16:30:33 CET 2007



> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-
> bounces at lists.sourceforge.net] On Behalf Of edalB
> Sent: Friday, January 19, 2007 7:46 AM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Event Handlers
> 
> Hi all.
> 
> I have created a event handler as a test to see how it works. The hard
> part I have done.
> 

[chop]

> define service{
>        use                             local-service
> 
>        host_name                       imap-1.rba.ispafrica.net
>        service_description           HTTP
>        event_handler                   restart-httpd
>        check_command              check_http
>        }

Do you have 'event_handler_enabled 1' in your local-service template?
You need it either there or in this definition. Enabling event handlers
in nagios.cfg isn't sufficient. You need to tell nagios which services
it should actually run them for.
 
> And the command
> 
> 
> define command{
>         command_name    restart-httpd
>         command_line    /usr/bin/ssh -p 222 -i
> /home/nagios/.ssh/id_dsa eugene at imap-1.rba.ispafrica.net sudo
> /etc/init.d/apache2 res
> tart
>         }
> 
> So now nagios still does not want to execute my command

You really should follow the documented methodology for event handlers
(http://nagios.sourceforge.net/docs/2_0/eventhandlers.html). I'm not
sure the above is going to work and if it does, it will attempt to
restart httpd on any kind of status change, even WARNING -> OK. I'm sure
that you don't want that. Additionally, if you follow the documented way
you can easily send debugging output to a file so that you can see if
your event handler is being run, how and what it's doing.

--
Marc 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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