[hobbit] getting alert to call scripts

Trent Melcher trent.melcher at sitel.com
Thu Aug 16 21:47:53 CEST 2007


On Thu, 2007-08-16 at 20:18 +0100, Robin Wood wrote:
> 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?

Does the /tmp/script file already exist?  Have you created it in your
testing?  I would say check permissions,  The scripts will get fired off
from the hobbit user, so the files will be created by hobbit.  If you
created them already as someone other than hobbit, that would be an
issue.

Other than that I dont see a problem,  I just ran the same scenario with
your script and it works perfectly.

Here was the output of the script:
Array
(
    [0] => /usr/local/scripts/test.php
    [1] => 123456789
    [2] => FORMAT=SMS
)


Trent

> 
> Thanks
> 
> Robin
> 
> To unsubscribe from the hobbit list, send an e-mail to
> hobbit-unsubscribe at hswn.dk
> 
> 



More information about the Xymon mailing list