event handlers looking strange feature of nagios

Martijn Lievaart m at rtij.nl
Sat Nov 20 13:53:48 CET 2004


sushilkumar wrote:

>Hello i have written a script which  restart a service on the remote
>machine from command prompt & if the login is root.
>
>I have also configured a event handler command which calls this script. but
>i think this script doesn't execute at all.
>
>the output which i found in the eventlogs is 
>[11-20-2004 15:59:52] SERVICE EVENT HANDLER: sun;RESET
>HTTPD;CRITICAL;HARD;4;restart-spooler
>
>restart-spooler is my event handler command
>
>but it never execute this script.
>
>the script permission is just like that
>
>-rwsr-xr-x  1 nagios   nagios  2275 Nov 20 16:25 /root/god/reset.sh
>
>Because this script tries to restart a service on remote host 
>i have attatched it 's' bit.
>
>can anybody throw some light on this topic
>  
>

I guess the script is executed as the nagios user. Two problems here.

First, the nagios user cannot read /root by default (and you should not 
change that). Move the script somewhere else.

Second, bash IIRC disallows suid scripts for security reasons. Rewrite 
in Perl (and test it with -T).

HTH,
M4



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
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