Event Handlers

edalB edalb1979 at gmail.com
Tue Jan 23 10:46:40 CET 2007


Ok I have followed the white rabbit.

I have followed the docs and I have modified the the script to work
the way I need it to work for me.

But still no luck.

After trying allot of stuff I have now changed my config in the .cfg
file and it looks like folloes.

define service{
        use                             local-service

        host_name                       imap-1.rba.ispafrica.net
        service_description             HTTP
        event_handler_enabled           1
        event_handler                   restart-httpd
        check_command                   check_http
        }

Then the commands.cfg file looks like follows.


define command{
        command_name    restart-httpd
        command_line    /usr/local/nagios/libexec/restart-httpd
$SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$
        }

But I still dont have any luck with the Event Handlers.

Regards

On 1/19/07, Hari Sekhon <hpsekhon at googlemail.com> wrote:
>
>  I was think that, I've done event handlers and the way you have tried to do
> that is just wrong. Look at the docs, there is a template bash script to get
> you started. That is what I based my event handlers on and it makes much
> more sense. You can choose when to do certain actions, not every single time
> the status changes which can be a heck of a lot.
>
>  For example when one of my known problem websites fails, the event handler
> only fires if it's critical and the plugin output tells me that a certain
> condition has occurred. I don't do anything when it's a warning state or a
> soft error or if the service check just timed out as sometimes happens since
> the website isn't down or broken.
>
>  Otherwise a congested pipe that causes the service check to time out and
> temporarily go critical then results in you trashing the website and kicking
> out users!
>
>  Follow the white rabbit... I mean... follow the docs...
>
>
>  -h
>  Hari Sekhon
>
>
>
>  Marc Powell wrote:
>
>
>  -----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
>
>
>
> -------------------------------------------------------------------------
> 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
>
>

-------------------------------------------------------------------------
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