Hi,
I've recently upgraded from zoneminder 1.30.4 to 1.32.2. All looks to be fine after the upgrade except that I cannot reset my events stats to zero. I have truncated the following tables in the database
Events
Events_Archived
Events_Day
Events_Hour
Events_Month
Events_Week
Stats
and have also cleared off all files under my ZM_DIR_EVENTS and ZM_DIR_IMAGES folders as specified in a .conf file under /etc/zm/conf.d
Regardless of the above actions, the zoneminder 1.32.2 console refuses to reset the number of events to zero and keeps showing previous figures. With version 1.30.4, I could always reset all event stats to zero by truncating the Events table in the database and by clearing off my events storage folders.
Please, could someone provide a solution for this apparently bizarre behaviour? Is there a cache somewhere that I am not aware of?
Any pointers would be most appreciated.
Regards
Dipak Jha
Incorrect stats on console
-
- Posts: 14
- Joined: Tue Oct 30, 2018 4:37 pm
Re: Incorrect stats on console
Hi,
I have been able to figure this out. In version 1.32.2 stats are also stored in the MySQL database (table: Monitors) which I don't think is good data design. Stats should be stored in the Event* tables which should be linked to Monitors using the MonitorID foreign key relationship.
Anyway, here are my steps now to purge zoneminder of all events and logs:
Stop zoneminder
Delete all event files (I have 6 cameras)
Log on to the database and run the following SQLs
Start zoneminder
Please let me know if I am doing anything wrong here.
Regards,
Dipak Jha
I have been able to figure this out. In version 1.32.2 stats are also stored in the MySQL database (table: Monitors) which I don't think is good data design. Stats should be stored in the Event* tables which should be linked to Monitors using the MonitorID foreign key relationship.
Anyway, here are my steps now to purge zoneminder of all events and logs:
Stop zoneminder
Code: Select all
systemctl stop zoneminder
Code: Select all
rm -rf <path to storage folder>/events/[1-6]/*
Code: Select all
truncate table Events; truncate table Events_Archived; truncate table Events_Day; truncate table Events_Hour; truncate table Events_Month; truncate table Events_Week; truncate table Logs; truncate table States; truncate table Stats; truncate table Frames;
update Monitors set TotalEvents = 0, HourEvents = 0, DayEvents = 0, WeekEvents = 0, MonthEvents = 0, ArchivedEvents = 0, MonthEventDiskSpace = null, WeekEventDiskSpace = null, DayEventDiskSpace = null, HourEventDiskSpace = null, TotalEventDiskSpace = null;
Code: Select all
systemctl start zoneminder
Regards,
Dipak Jha
Re: Incorrect stats on console
Scanning over the Event* tables is actually quite intensive when you have a lot of events. Instead of doing that we use triggers to update the summary fields in the Monitors table.
Database design for scalability is not as obvious as you might think. I had to learn a lot to get ZM to scale to over 800 cameras.
Database design for scalability is not as obvious as you might think. I had to learn a lot to get ZM to scale to over 800 cameras.
-
- Posts: 14
- Joined: Tue Oct 30, 2018 4:37 pm
Re: Incorrect stats on console
Hi iconnor,
It is my privilege to interact with you directly. I now see the point and also recall that I had done something similar on an eCommerce website with a huge number of saleable products (and their prices, stock levels etc). My apologies for the oversight.
Great product and a fantastic release (1.32.2). All works fine for me now.
Thanks for your response and the support you are offering
Regards
Dipak Jha
It is my privilege to interact with you directly. I now see the point and also recall that I had done something similar on an eCommerce website with a huge number of saleable products (and their prices, stock levels etc). My apologies for the oversight.
Great product and a fantastic release (1.32.2). All works fine for me now.
Thanks for your response and the support you are offering
Regards
Dipak Jha
Re: Incorrect stats on console
Thanks, with this instructions I was able to reset the events in the database.superdipak wrote: ↑Wed Oct 31, 2018 5:59 am Hi,
I have been able to figure this out. In version 1.32.2 stats are also stored in the MySQL database (table: Monitors) which I don't think is good data design. Stats should be stored in the Event* tables which should be linked to Monitors using the MonitorID foreign key relationship.
Anyway, here are my steps now to purge zoneminder of all events and logs:
Stop zoneminderDelete all event files (I have 6 cameras)Code: Select all
systemctl stop zoneminder
Log on to the database and run the following SQLsCode: Select all
rm -rf <path to storage folder>/events/[1-6]/*
Start zoneminderCode: Select all
truncate table Events; truncate table Events_Archived; truncate table Events_Day; truncate table Events_Hour; truncate table Events_Month; truncate table Events_Week; truncate table Logs; truncate table States; truncate table Stats; truncate table Frames; update Monitors set TotalEvents = 0, HourEvents = 0, DayEvents = 0, WeekEvents = 0, MonthEvents = 0, ArchivedEvents = 0, MonthEventDiskSpace = null, WeekEventDiskSpace = null, DayEventDiskSpace = null, HourEventDiskSpace = null, TotalEventDiskSpace = null;
Please let me know if I am doing anything wrong here.Code: Select all
systemctl start zoneminder
Regards,
Dipak Jha
Re: Incorrect stats on console
In 1.36.x i had to do,
Code: Select all
truncate table Event_Summaries;
update Event_Summaries set TotalEvents = 0, HourEvents = 0, DayEvents = 0, WeekEvents = 0, MonthEvents = 0, ArchivedEvents = 0, MonthEventDiskSpace = null, WeekEventDiskSpace = null, DayEventDiskSpace = null, HourEventDiskSpace = null, TotalEventDiskSpace = null;