Page 1 of 1

notify email recipient on error

Posted: Sat Aug 31, 2024 3:27 pm
by alabamatoy
Is there a way to make ZM send me an email when an error is encountered? I tried to write a filter and cant seem to find anything about error conditions.....

Re: notify email recipient on error

Posted: Sun Sep 01, 2024 3:30 pm
by iconnor
I use a program called logcheck to send me any errors that get logged to syslog. Then set ZM to log warnings to syslog. Works for me.

Re: notify email recipient on error

Posted: Sun Sep 01, 2024 4:16 pm
by mikb
alabamatoy wrote: Sat Aug 31, 2024 3:27 pm when an error is encountered?
Can you be more specific on what kind of error/where the error is supposed to be coming from?

Re: notify email recipient on error

Posted: Tue Sep 03, 2024 3:01 pm
by alabamatoy
mikb wrote: Sun Sep 01, 2024 4:16 pm
alabamatoy wrote: Sat Aug 31, 2024 3:27 pm when an error is encountered?
Can you be more specific on what kind of error/where the error is supposed to be coming from?
Im talking about an error that appears in the ZM log. Logcheck eventually sends me the entire log, 12 hours worth twice a day, but I was trying to get ZM (or something else) to notify me with an email message whenever a particular log event occurs within ZM. I would like to get an immediate notification for

Code: Select all

8/28/24, 5:48:28 PM EDT	web_php	1189091	WAR	Login denied for user "XXXX"
while ignoring something like

Code: Select all

9/2/24, 4:04:35 AM EDT	zmc_m4	1126489	ERR	Unable to open input rtsp://10.1.1.158:554/cam/realmonitor?channel=1&subtype=0 due to: Connection refused	zm_ffmpeg_camera.cpp	368
I see a flurry of these connection refused errors once in a while when the cameras restart etc but they only last a few seconds and go away. I have a user who has some issues with logins and passwords, and want to be alerted when he's having difficulty.
If logcheck can do this, I dont know how to configure it.

Re: notify email recipient on error

Posted: Tue Sep 03, 2024 5:13 pm
by mikb
If there isn't a way to do that inside Zoneminder, then I'd be watching e.g. /var/log/zm/zm.log with a separate process, and watching for your key phrases to come up -- e.g. using "tail -f" to follow the end of the log and "grep -e 'Login denied for user' -e 'Another error' -e 'And Another error'" to pick off specific messages or reg-exps of messages.

Re: notify email recipient on error

Posted: Tue Sep 03, 2024 5:58 pm
by burger
Cron and grep works for me:
https://wiki.zoneminder.com/SMS_Notific ... _HDD_Fails

It's somewhat unfortunate to say that ZM needs monitoring scripts in order to run, as things are always breaking, but I don't know how it can be built into ZM without being more bloat. Maybe there can be optional shell scripts that are included in /usr/share/zoneminder. I've just made my own over time. Or you can use dedicated monitoring software but that has its own learning curve.