event handler command not executing

Marc Powell marc at ena.com
Tue Mar 9 04:22:42 CET 2010


On Mar 8, 2010, at 7:58 PM, Rick Garland wrote:

> define command{
>     command_name            remount-nfs
>     command_line               $USER1$/eventhandlers/remount-nfs $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$
> }
>  
> enable_event_handlers=1 in the nagios.cfg file
>  
> The script itself is very simple. At CRITICAL/SOFT/3 and CRITCAL/HARD/4 the script will execute. Running at command line as UID=nagios it runs fine.
> sudo is configured and nagios can mount NFS.
>  
>  
> The entry in the nagios.log
> [1268099555] SERVICE_EVENT_HANDLER: my_host;NFS CHECK;CRITCAL;SOFT;3;remount-nfs!CRITCAL!SOFT!3

Nagios is running it. This is good.

> I have followed the process through and it will not execute the remount-nfs event handler command.

>  
> What is missing?

First guess: you have REQUIRETTY enabled in your sudoers file (run visudo and check).
Second guess: $USER1$ doesn't point to the location of {?}/eventhandlers/remount_nfs.
Third guess: you do not use hard-coded paths to programs used within remount-nfs. The working environment for scripts executed by nagios is very minimal. Don't depend on $PATH being as complete as it is during an interactive session. Hard code paths to everything. That should be a BCP anyway.

Try adding a bit at the top of the script to touch a file or something to see if it really ran and is maybe failing further into the script (i.e. because of a potential sudo restriction).

--
Marc


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
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