[hobbit] Alert script help

Henrik Stoerner henrik at hswn.dk
Wed Sep 13 22:10:46 CEST 2006


On Wed, Sep 13, 2006 at 11:58:25AM -0500, Francisco Carmona Leon wrote:
> I need help to make this work.
> 
> this is my configuration:
> 
> hobbit-alerts.cfg
> HOST=*
>         SCRIPT /usr/local/bin/smalert 1234123400 FORMAT=SMS

Looks ok.

> script
> #!/bin/sh
> /usr/local/bin/lee '"$BBHOSTNAME" alerta "$BBCOLORLEVEL" servicio
> "$BBSVCNAME" con la direccion "$MACHIP" fuera por "$DOWNSECS"'

There's a problem with the quoting of this. In most cases I've seen,
when you put something inside single quotes in a shell, then environment
variables are NOT expanded by the shell. E.g.:

   $ echo '"$BBHOSTNAME" alerta "$BBCOLORLEVEL"'
   "$BBHOSTNAME" alerta "$BBCOLORLEVEL"

> I'm using the script option in my hobbit-alerts.cfg file because I need
> to send a voice alert in my site but it doesn't work.

"doesn't work" is fairly broad. Does your script get called when you
expect it to ? You can put a statement into the script to log something
to a file, so you can see if the script runs at all. My guess is that
the script does run, but your script doesn't do as you expect it to.
In that case, try running your script by hand:

   BBHOSTNAME=myhost BBCOLORLEVEL=yellow \
   BBSVCNAME=conn MACHIP=10.0.0.1 \
   DOWNSECS=120 \
   /path/to/script 1234123400

You can also look at the "page.log" file in the hobbit logs directory;
this captures any error messages generated by your script.


Regards,
Henrik




More information about the Xymon mailing list