Event Handlers

Andy Shellam (Mailing Lists) andy.shellam-lists at mailnetwork.co.uk
Fri Jan 19 15:10:16 CET 2007


Please please please don't forgot to copy your responses to the list!

Yep Nagios is executing your service handler (or at least trying to.)
Try executing your command from an SSH console as the Nagios user.

Andy.


edalB wrote:
> This is what I see in the log file
>
> Jan 19 15:21:18 nagios-0 nagios: SERVICE ALERT:
> imap-1.rba.ispafrica.net;HTTP;CRITICAL;SOFT;1;Connection refused
> Jan 19 15:21:18 nagios-0 nagios: SERVICE EVENT HANDLER:
> imap-1.rba.ispafrica.net;HTTP;CRITICAL;SOFT;1;restart-httpd
>
> And I do have it enabled in my nagios.cfg config file
>
> Regards
>
> On 1/19/07, Andy Shellam (Mailing Lists)
> <andy.shellam-lists at mailnetwork.co.uk> wrote:
>> Are event handlers enabled for this service?
>> Do they show up as executed in the log file when your HTTP service goes
>> down?
>>
>>
>> edalB wrote:
>> > Hi all.
>> >
>> > I have created a event handler as a test to see how it works. The hard
>> > part I have done.
>> >
>> > I created a ssh key on on the nagios server. I tested that I am able
>> > to connect via ssh over to the other server working 100% fine.
>> >
>> > I then next tested my ssh connection using my ssh key to execute the
>> > sudo apache2 restart on the other server all worked 100%.
>> >
>> > So in thury all is working nicely from command line.
>> >
>> > The command line command I am using is.
>> >
>> > /usr/bin/ssh -p 222 -i /home/nagios/.ssh/id_dsa user at server sudo
>> > /etc/init.d/apache2 restart
>> >
>> > So what I did was I then added a extra line in my host
>> >
>> > define service{
>> >        use                             local-service
>> >
>> >        host_name                       imap-1.rba.ispafrica.net
>> >        service_description           HTTP
>> >        event_handler                   restart-httpd
>> >        check_command              check_http
>> >        }
>> >
>> > 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
>> >
>> > Any advice would be appriciated.
>> >
>> > Thanks
>> >
>> > 
>> ------------------------------------------------------------------------- 
>>
>> > 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
>> >
>> > >
>> >
>> >
>>
>>
>> -- 
>> Andy Shellam
>> NetServe Support Team
>>
>> the Mail Network
>> "an alternative in a standardised world"
>>
>> p: +44 (0) 121 288 0832/0839
>> m: +44 (0) 7818 000834
>>
>>
>
> !DSPAM:37,45b0d09e137101451594761!
>
>

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