Alert script help
list Francisco Carmona Leon
I need help to make this work.
this is my configuration:
hobbit-alerts.cfg
HOST=*
SCRIPT /usr/local/bin/smalert 1234123400 FORMAT=SMS
script
#!/bin/sh
/usr/local/bin/lee '"$BBHOSTNAME" alerta "$BBCOLORLEVEL" servicio
"$BBSVCNAME" con la direccion "$MACHIP" fuera por "$DOWNSECS"'
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.
why ?
list Henrik Størner
▸
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=SMSLooks 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
list Francisco Carmona Leon
I saw in the page.log this line: sox: Can't open output file '/dev/dsp': Permission denied I changed this and now is shouting all my alerts. root at larissa:~# ll /dev/dsp crw-rw---- 1 root audio 14, 3 2006-09-07 17:24 /dev/dsp root at larissa:~# chmod 666 /dev/dsp root at larissa:~# ll /dev/dsp crw-rw-rw- 1 root audio 14, 3 2006-09-07 17:24 /dev/dsp Muchas gracias. Saludos desde Veracruz, México.
▸
On Wed, 2006-09-13 at 22:10 +0200, Henrik Stoerner wrote:
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=SMSLooks 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