Event Handlers Problem

Marc Powell marc at ena.com
Wed May 4 16:51:58 CEST 2005



> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
> admin at lists.sourceforge.net] On Behalf Of Thomas Beecher
> Sent: Wednesday, May 04, 2005 9:31 AM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Event Handlers Problem
> 
> I am working with the Nagios event handlers, and I'm coming across a
> problem I can't seem to get a handle on.
> 
> I've got a perl script (restart_pm3.pl) that I want to be called as a
> host event handler, and pass two macros: $HOSTNAME$ and $HOSTSTATE$.
At
> present, I have the following set up:
> 
> In hosts.cfg
> 
> define host{
>          use             generic-host
>          host_name       buftest
>          alias           buftest
>          address         10.0.2.152
>          contact_groups  noc
>          event_handler   restart_pm3
> }
> 
> In checkcommands.cfg
> 
> define command{
>          command_name    restart_pm3
>          command_line    /home/tbeecher/test_scripts/restart_pm3.pl
> $HOSTNAME$ $HOSTSTATE$
> }
> 
> 
> The Nagios logs show that the even handler is called when the service
> checks fail and the host goes down:
> 
> [1115216792] HOST ALERT: buftest;DOWN;HARD;10;Telnet: CRITICAL -
Socket
> timeout after 1 seconds<br>SNMP: CRITICAL: snmpget returned errors: 1
(
>   )<br>PING: CRITICAL - Host Unreachable (10.0.2.152)
> [1115216792] HOST EVENT HANDLER: buftest;DOWN;HARD;10;restart_pm3
> 
> So far so good right?
> 
> Well, the actual perl script is never executed. I have execute
> permissions on it for everyone, and edited it so it logs every time it
> is executed, and what ARGVs were passed to it. Works fine when called
> manuallt from a command line, but Nagios never calls is. Any insight?

On most modern systems, user accounts in /home are only accessible by
that user (i.e. tbeecher in your case). Are the permissions on
/home/tbeecher such that the nagios user can access the directory? I
know you said you tested it from the command line but you didn't specify
if your test was run as the nagios user.

--
Marc


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r 
_______________________________________________
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