Event handlers

Hi

I have created one event handler for one of the services that i am monitoring. this is the event log
(for this post i have modified the service)


[04-15-2011 12:07:39] SERVICE EVENT HANDLER: Gssdev;Internet Explorer;CRITICAL;SOFT;2;start-testfile
[04-15-2011 12:07:39] SERVICE ALERT: Gssdev;Internet Explorer;CRITICAL;SOFT;2;iexplore.exe: not running


now start-testfile.sh does executes but due to user rights issue (i think), ubuntu does not allows it to continue.

i am able to execute this script from the terminal, but not through nagios :frowning:

i have modified my sudoers file by adding these lines

nagios ALL=NOPASSWD: ALL

###and got this from another article, so i have added these lines also

User_Alias NAGIOS = nagios,nagcmd
Cmnd_Alias NAGIOSCOMMANDS = /sbin/service
Defaults:Nagios !requiretty
NAGIOS ALL=ALL NOPASSWD:NAGIOSCOMMANDS


now, just to check, i deleted my original code and entered this in start-testfile.sh

                  ------------------
                        cd /tmp/
                        mkdir iexplore
                        exit 0
                   
                  -------------------

after doing this, the script was creating a directory in tmp folder, but not anywhere else. so my guess is user rights is preventing the execution of the script…
Can you guys please suggest how can i run any type of script from the event handler…i have been trying since last 2 days…thank you

and also if you have any good article on event handlers and on their setup, please post the link

OS - Ubuntu 10.10

have you tried running that as user nagios?
has the script full paths to any file it should execute?

Yes, i have tried executing the same thing as user nagios (from terminal) and it works, but it doesnt works when nagios calls it.

and yes it has the full path for the file it should execute, as mentioned above if i add cd /tmp/ then the “iexplore” directory gets created in the tmp folder. But if i replace cd /tmp/ with any other path then “iexplore” directory is not created.

thanks, waiting for your reply

sorry i have no experience at all with sudo and the sudoers file… isn’t there anything useful in the logs?

i think i have found the problem, ubuntu 10.10 does not allows you to run sudo in local scripts, i will post my solution once i get around this problem…thx for your help…