zmaudit not clearing up after zmfilter deletes events 1.21.1

Support and queries relating to all previous versions of ZoneMinder
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

zmaudit not clearing up after zmfilter deletes events 1.21.1

Post by lazyleopard »

Is there a known problem with zmaudit not clearing away event directories after zmfilter has deleted events in 1.21.1 (or perhaps even 1.21.0)? Reason I ask is that I've noticed zmaudit reporting it's cleaning up a few events which have been deleted from the database, but that the actual file system contains large numbers of event directories which don't belong to events that still exist in the database. Yet zmfilter is reporting that it's deleting events.

At present, the database says one of my cameras has 965 active and 27 archived events, but the directory for that camera contains 3314 event directories, many (a great many more than 27) of which are older than the oldest recorded non-archived event, but zmaudit doesn't seem to be interested in clearing them away.

It's not as if zmaudit isn't running, though.

Code: Select all

-rw-r--r--  1 apache apache     65 Jun 19 03:15 zmtrigger.log
-rw-r--r--  1 apache apache    895 Jun 19 03:15 zmpkg.log
-rw-r--r--  1 apache apache     71 Jun 19 03:15 zmwatch.log
-rw-r--r--  1 apache apache   1473 Jun 20 11:03 zmdc.log
-rw-r--r--  1 apache apache 159572 Jun 21 11:46 zmaudit.log
-rw-r--r--  1 apache apache 133663 Jun 21 11:58 zmfilter.log
Rick Hewett
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Are the remaining directories empty, or do they still have contents?

Phil
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post by lazyleopard »

Very definitely full. I spotted the problem when the PurgeWhenFull filter failed to live up to its name even though it was deleting events from the database.
Rick Hewett
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post by lazyleopard »

Weird thing, as you might be able to see from the log snippets in http://www.zoneminder.com/forums/viewtopic.php?t=3547, is that zmaudit is deleting a few events, but it never seems to catch up with the event entries zmfilter deletes, even when zmfilter gets to a point where it's no longer deleting things. (I did have to cheat and go and delete some data to get the filesystem under the magic x% that triggered PurgeWhenFull...)
Rick Hewett
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Can your restart zmaudit and post the first 50 or so lines from the log file, or more if they are useful. I know you posted some of this on the other thread but I don't think it was from the top of the log file.

Phil
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post by lazyleopard »

Hmmm... They don't look very helpful... Probably need a higher debug level?
zmfilter.log just says this:

Code: Select all

Scanning for events
and zmaudit.log says this:

Code: Select all

Found database monitor '5', got 518 events
Found database monitor '6', got 985 events
Found database monitor '7', got 237 events
Found database monitor '8', got 3 events
Found database monitor '9', got 338 events
Found database monitor '10', got 0 events
Found filesystem monitor '10', got 0 events
Found filesystem monitor '5', got 2501 events
Found filesystem monitor '6', got 3289 events
Found filesystem monitor '7', got 472 events
Found filesystem monitor '8', got 3 events
Found filesystem monitor '9', got 884 events
Deleting 2 old images
Rick Hewett
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post by lazyleopard »

...though the zmaudit log does show the discrepancies in event counts.
Rick Hewett
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Can you confirm this is 1.21.1?

Phil
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post by lazyleopard »

Yep. 1.21.1.

I've been peering at zmaudit.pl to try to figure out why it finds those differences and then does nothing about them. No blinding revelations so far...
Rick Hewett
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Can you try editing zmaudit.pl (you might as well try this directly on the installed one). Find the line

Code: Select all

                $fs_events->{$event} = -1;
and change

Code: Select all

                $fs_events->{$event} = 0;
Light blue touch paper and retire. Check the log and make sure it's not wiping out everything but only those events it's supposed to.

Phil
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Actually, probably best not to do that just yet. I've tried it here and I don't think it's quite right.

Phil
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post by lazyleopard »

Ok... ;)
Rick Hewett
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Ok, take 2, after wiping out a bunch of real events! :lol:

In zmaudit.pl find the line just below the one in the prevous post (about line 236 I think) that looks like

Code: Select all

if ( !$db_events->{$fs_event} && (!$age || ($age > MIN_AGE)) )
and change it to

Code: Select all

f ( !$db_events->{$fs_event} && ($age < 0 || ($age > MIN_AGE)) )
Then restart zmaudit.pl. Don't apply the previous change, just this one. You might want to stop ZM altogether and run zmaudit from the command line as

zmaudit.pl

for interactive mode (soon to be deprecated) or

zmaudit.pl -r

to get it just to tell you what it would do without actually doing anything.

Phil
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post by lazyleopard »

That would appear to want to delete the correct number of events...

5098 of them!

Thanks. ;)
Rick Hewett
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

That has helped out my issue as well :D
Thanks Phil 8)
Regards,
Cordel
Image
Image
3939663646337

It's better to keep your mouth shut and appear stupid than open it and remove all doubt.
-Mark Twain
Locked