Hi I've setup an alert to call a script but I must have something wrong as the scripts are never getting called.
The alert is:
HOST=devsite SERVICE=http MAIL dninja at gmail.com DURATION>5 SCRIPT /usr/local/bin/sendsms 1234567890 FORMAT=SMS SCRIPT /usr/local/bin/sendemail 1234567890 FORMAT=TEXT SCRIPT /usr/local/bin/sendscript 1234567890 FORMAT=SCRIPT
And to test it:
/usr/lib/hobbit/server/bin/hobbitd_alert --test devsite http 00026523 2007-08-16 20:14:41 send_alert devsite:http state Paging 00026523 2007-08-16 20:14:41 Matching host:service:page 'devsite:http:' against rule line 29 00026523 2007-08-16 20:14:41 *** Match with 'HOST=devsite SERVICE=http' *** 00026523 2007-08-16 20:14:41 Matching host:service:page 'devsite:http:' against rule line 30 00026523 2007-08-16 20:14:41 Failed 'MAIL dninja at gmail.com DURATION>5' (min. duration 0<300) 00026523 2007-08-16 20:14:41 Matching host:service:page 'devsite:http:' against rule line 29 00026523 2007-08-16 20:14:41 *** Match with 'HOST=devsite SERVICE=http' *** 00026523 2007-08-16 20:14:41 Script alert with command '/usr/local/bin/sendsms' and recipient 1234567890 00026523 2007-08-16 20:14:41 Matching host:service:page 'devsite:http:' against rule line 29 00026523 2007-08-16 20:14:41 *** Match with 'HOST=devsite SERVICE=http' *** 00026523 2007-08-16 20:14:41 Script alert with command '/usr/local/bin/sendemail' and recipient 1234567890 00026523 2007-08-16 20:14:41 Matching host:service:page 'devsite:http:' against rule line 29 00026523 2007-08-16 20:14:41 *** Match with 'HOST=devsite SERVICE=http' *** 00026523 2007-08-16 20:14:41 Script alert with command '/usr/local/bin/sendscript' and recipient 1234567890
All the scripts are in place
ls -l /usr/local/bin/send* -rwxr-xr-x 1 root root 101 2007-08-16 19:19 /usr/local/bin/sendemail -rwxr-xr-x 1 root root 103 2007-08-16 19:18 /usr/local/bin/sendscript -rwxr-xr-x 1 root root 100 2007-08-16 19:19 /usr/local/bin/sendsms
yet when I stop the webserver and cause the status to go red none of the scripts get called.
The scripts currently just write to a file the fact they have been called and their parameters so that I can see what I have to play with:
cat /usr/local/bin/sendscript #!/usr/bin/php <? $h = fopen ("/tmp/script", "a"); fwrite ($h, print_r ($argv, true)); fclose ($h); ?>
I've got something wrong, what is it?
Thanks
Robin