Event Handlers

edalB edalb1979 at gmail.com
Fri Jan 19 15:13:35 CET 2007


I have done that and it does work.

nagios-0 libexec # su nagios
nagios at nagios-0 /usr/local/nagios/libexec $ /usr/bin/ssh -p 222 -i
/home/nagios/.ssh/id_dsa eugene at imap-1.rba.ispafrica.net sudo
/etc/init.d/apache2 restart
 * Service apache2 stopping
apache2: Could not determine the server's fully qualified domain name,
using 127.0.0.1 for ServerName
 * Service apache2 stopped
 * Service apache2 starting
apache2: Could not determine the server's fully qualified domain name,
using 127.0.0.1 for ServerName
 * Service apache2 started
nagios at nagios-0 /usr/local/nagios/libexec $

On 1/19/07, Andy Shellam (Mailing Lists)
<andy.shellam-lists at mailnetwork.co.uk> wrote:
> 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