Customized Script not running


#1

Hi,
I have created my own shell script and want to schedule the same through Nagios as notification. I have added proper entries in command.cfg and templates.cfg but still the things are not working.

Can you please suggest how I can make that notification run ?

Nagios is version 3.2 on linux machine

Rgds,
GS


#2

Could you post the entries you added in command.cfg, templates.cfg …etc
anything that may help us to help you


#3

Commands.cfg:
define command{
command_name test-notify
command_line /usr/bin/test_nagios.sh
}

Templates.cfg
service_notification_commands notify-service-by-email,test-notify ; send service notifications via email
host_notification_commands notify-host-by-email,test-notify ; send host notifications via email

test_nagios.sh script has:
touch /root/gautam/new.txt

Rgds,
GS


#4

and could you post the service definition ?


#5

I have not changed anything else. Please suggest where all I have to make changes ?

Rgds,


#6

Normally it is good practice to keep all of your check/notify scripts in one place, generally the nagios/libexec folder. If you look at other scripts in there you will see they are generally owned by the nagios user & group, which have permissions to run the script, like
-rwxr-xr-x 1 nagios nagios …
Are the permissions on test_nagios.sh as above?