Page 1 of 1

Trigger notification as soon as alarm starts

Posted: Sat Sep 03, 2016 12:53 pm
by Dan12345
Hi,

I'm trying to trigger a notification as soon as an alarm starts (i.e. immediately, and not once the event has finished).

So I set up a filter running in the background which has "monitor name equal to [name of monitor]". However this only fires when the event is finished. Is there a way I can trigger it immediately?

thanks,

Dan

Re: Trigger notification as soon as alarm starts

Posted: Sat Sep 03, 2016 1:37 pm
by asker
Google for zmeventserver

Re: Trigger notification as soon as alarm starts

Posted: Sat Sep 03, 2016 1:42 pm
by Dan12345
brilliant - thank you!

Re: Trigger notification as soon as alarm starts

Posted: Sat Sep 03, 2016 2:40 pm
by Dan12345
On second thoughts - ouch - much too complicated for me. I just want to run a simple script when an alarm is received, and zmeventserver looks like overkill. Using swatch to monitor syslog seems a lot easier...

Re: Trigger notification as soon as alarm starts

Posted: Sat Sep 03, 2016 4:45 pm
by asker
Sure. That seems reasonable for what you want too.

Re: Trigger notification as soon as alarm starts

Posted: Sat Sep 03, 2016 10:34 pm
by Dan12345
On third thoughts, even swatch is overkill - awk does the trick, run at reboot with cron:

tail -F /var/log/syslog | awk ‘/FireEscape.*alarm start/ { system("wget http://[openhab server]/CMD?CamFireEscape=ON -P /tmp") }'

(and that flicks a virtual switch in my openHAB setup to run notifications etc)

Re: Trigger notification as soon as alarm starts

Posted: Thu Sep 08, 2016 4:09 am
by JTheDoc
Hello Dan, you don't happen to know how to implement your method so I may run a simple .sh script? I'm attempting to have a PTZ camera look a certain direction when motion is detected on another camera.

The script I've got working perfectly fine, I believe putting the script in a folder that www-data has permissions for, and setting the .sh to executable should be enough, but I haven't been able to put this into practice, as filters don't work (Doesn't work, and would be too slow to respond), so having awk trail the logs for "alarm" should be enough for me. If you could help, I would be very grateful! Thank you, and I hope you've been getting along better with ZM much less awkwardly and stressful as I have!
Cheers,

Josh.