notify email recipient on error

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
alabamatoy
Posts: 360
Joined: Sun Jun 05, 2016 2:53 pm

notify email recipient on error

Post 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.....
User avatar
iconnor
Posts: 3119
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: notify email recipient on error

Post 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.
mikb
Posts: 655
Joined: Mon Mar 25, 2013 12:34 pm

Re: notify email recipient on error

Post 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?
alabamatoy
Posts: 360
Joined: Sun Jun 05, 2016 2:53 pm

Re: notify email recipient on error

Post 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.
mikb
Posts: 655
Joined: Mon Mar 25, 2013 12:34 pm

Re: notify email recipient on error

Post 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.
User avatar
burger
Posts: 416
Joined: Mon May 11, 2020 4:32 pm

Re: notify email recipient on error

Post 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.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
Post Reply