This will setup your ZM box to play a wav file on it's local speakers every time the desired monitor goes into alarm.
I use it for the monitor on my driveway and on the front door monitor . My office is in the back side of the house so I sometimes don't know when a car pulls in let alone hear someone knocking at the door.
What it does is watch the system message log for the name of the monitor and alarm state, and executes a wav file when it matches any new entries.
I'm running ZM on Ubuntu 8.04.1 lts so this may need to be modified for different distro's .
First off I did all of this as root.
Put the .wav files you want to use in the ./ filesystem directory.
Create a new text document save it with a ( .sh ) extension check the permissions and enable it to be executable. Add the text below to the file sub out (signal ) for the name of the monitor you wish to use it on, and (ping).wav for the name of your wav file.
Code: Select all
#!/bin/bash
tail -f /var/log/messages | grep --line-buffered 'signal.*Gone into alarm state' | while read line; do aplay /ping.wav; done
Code: Select all
#!/bin/bash
pkill -9 tail
/etc/crontab
Mine looks like this with my added scripts at the bottom.
Code: Select all
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
30 21 * * * root /killalarm.sh
30 6 * * * root /zmalarm.sh
30 6 * * * root /zmalarm2.sh
#
Allan