Database Cleanup?

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
Ruler
Posts: 232
Joined: Mon Nov 08, 2004 9:02 pm
Location: Bay City, MI

Database Cleanup?

Post by Ruler »

I installed and used a very old ZoneMinder box. When it died last year, I installed 1.36.33 on a newer system. Unfortunately, I ran into an issue where the ]inode table got full (viewtopic.php?t=33019) and ZM was complaining the disk was full even though there was over 700 gig of space left. After getting input here & doing research elsewhere, I stopped the zoneminder service, backed up the directory except for the events/#/* directories, unmounted the file system, created a new ext4 file system with 2.5x the number of inodes the prior one had, adjusted fstab to mount it by device ID rather than UUID, mounted it, restored the backup, and finally started the zoneminder service. ZoneMinder appears to be recording again & hopefully this will be the end of the issue with the inodes running out.

Unfortunately, all of the old events (none of which exist on disk anymore) are still being shown in the ZoneMinder GUI. The ancient version I was using would clean up the database on it's own if an event was removed from disk, but this does not appear to be happening in the new version. Is there a way to trigger this to happen or do I need to go mucking around in the database, using SQL to erase the events in it directly?
This message is made up of not less than 90% recycled electrons.
dougmccrary
Posts: 1215
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Database Cleanup?

Post by dougmccrary »

Did you try zmaudit? sudo zmaudit.pl
or turn on Options->System->RUN_AUDIT, but back off after it runs a day or three.
Not that it's not real fast...
User avatar
burger
Posts: 390
Joined: Mon May 11, 2020 4:32 pm

Re: Database Cleanup?

Post by burger »

This was recently talked about. The zm.Event_Summaries table is the one that has the data that shows on the website. When backing up only the config, it is ignored see: https://wiki.zoneminder.com/MySQL#Backup_config_only and that starts the numbers back at zero. I think in your case clearing the table might restore it back to zero (but untested at the moment). If you start recording on one of those monitors, it should refresh the numbers for that monitor.
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
Ruler
Posts: 232
Joined: Mon Nov 08, 2004 9:02 pm
Location: Bay City, MI

Re: Database Cleanup?

Post by Ruler »

Thank you - running zmaudit is cleaning up the database as I write this. :)
This message is made up of not less than 90% recycled electrons.
Ruler
Posts: 232
Joined: Mon Nov 08, 2004 9:02 pm
Location: Bay City, MI

Re: Database Cleanup?

Post by Ruler »

FYI, the zmaudit.pl script finished and left several thousand events behind in the database that do not exist on the disk. Ran it several times & all it reported was several lines of 'Deleted 10 log table entries by time'. Had to create a custom filter to delete all events older than a few days ago - that is now running to flush out the old events.
This message is made up of not less than 90% recycled electrons.
dougmccrary
Posts: 1215
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Database Cleanup?

Post by dougmccrary »

Yeah it doesn't always do the job, unfortunately. Dunno why.
While you're at it, make sure you don't have a bunch of trash in the trash...
Post Reply