[SOLVED] Event count in ZoneMinder console

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
zmf
Posts: 10
Joined: Thu Oct 15, 2020 2:45 pm

[SOLVED] Event count in ZoneMinder console

Post by zmf »

I have a ZoneMinder 1.34.21 installation which has an issue with the event counters. I have four cameras and for each camera the event count for Hour/Day/Week/Month is the same. It's a different count for each camera but the count is the same across time periods. Eg Camera one has 1794 evens in the last day, 1794 in the last week and 1794 in the last month.

Looking at the DB, I see tables Events_Day, Events_Hour, Events_Week, etc. Presumably they hold the event for those time periods? What I see is that each table contains the same data. Eg the record count is the same across all Events_* tables. In Events_Hours, I can see events with date stamps from the last month.

I'm assuming that there should be some process that deletes events from Event_Hour after an hour?

I've tried searching for advice on a well-known Internet search engine, although finding the correct way to word my issue in a search engine friendly manner is proving tricky!

Could anyone offer any advise on how to correct this issue or of my assumption as to the cause is somewhat off track, please offer me directions to the path of enlightenment?
Last edited by zmf on Mon Oct 19, 2020 10:46 pm, edited 1 time in total.
User avatar
iconnor
Posts: 3357
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Event count in ZoneMinder console

Post by iconnor »

Sounds like for some reason your db doesn't have the triggers installed.

You can add them with:
mysql -u zmuser -p zm < /usr/share/zoneminder/db/triggers.sql
zmf
Posts: 10
Joined: Thu Oct 15, 2020 2:45 pm

Re: Event count in ZoneMinder console

Post by zmf »

Thanks for the tip. I took a look at the MySQL server and it looks like the triggers are in place. Just to be sure, I reran the .sql script and the triggers were recreated, however the issue remains. If I manually remove old entries from the Events_Hour, Events_Week, etc tables, then the counters do work correctly but then the table starts filling again and the counters go out of sync.

Looking at the triggers, it doesn't look like they are meant to house keep the Events_* tables. The only trigger (as far as I can see) that deletes entries from Events_* is a trigger which is set to run when a DELETE is called on the main Event table. Presumably this is meant to run if an event is deleted by manaul intervention or something like the PurgeWhenFull filter? There must be some other process to trim the Event_* tables once their timeframe has expired? I'm working on the assumption here that Event_Hour should only contain events that were within the last hour and after that they should be deleted. I've tried to find in the docs something explaining how this works but I haven't come up with anything.

I've set up a cronjob that runs a PERL script that calls a DELETE on the tables to cull entries older than their timeframes, which does seem to fix the issue however, I would like to get to the bottom of how this is meant to work in ZoneMinder and actually fix it!

Thanks again for your help.
User avatar
iconnor
Posts: 3357
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Event count in ZoneMinder console

Post by iconnor »

deleting is done in the zm_stats.pl daemon.
zmf
Posts: 10
Joined: Thu Oct 15, 2020 2:45 pm

Re: [SOLVED] Event count in ZoneMinder console

Post by zmf »

Thanks very much for this tip. I checked and zmstats was not running. I kicked it off manually and it cleared down the tables. After a quick search with a well-known Internet search engine, I discovered that zmstats needs to run on only one server and is set in the server settings. I checked and it was set to not run. Changed it to run, restarted Zoneminder and it started up and now the tables are being cleared and the counters are working! This has been a thorn in my side for some time. Thanks so much for helping me to get it sorted!
Post Reply