Please help with Purge filter

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
kibbling
Posts: 20
Joined: Fri Oct 07, 2022 12:45 pm

Please help with Purge filter

Post by kibbling »

Hello,

please see screenshot.

I have a 4 TB second drive "ExternalUSB" and want to fill it up to 80% with events.
Currently its about 9766 Events for the 48% used, each Event is about 60 MB in size.
But ZM keeps deleting everything down to 48%.
What is wrong with my filter?

Thank you for your help, I got stuck there.
Attachments
purge.png
purge.png (43.33 KiB) Viewed 982 times
kibbling
Posts: 20
Joined: Fri Oct 07, 2022 12:45 pm

Re: Please help with Purge filter

Post by kibbling »

"List Matches" gives always an empty List regardless the setting of the "disk Percentage"
"Export Matches" Gives always 100 Results, regardless the setting of the "disk Percentage"
"Debug" and execute the Query in PHPMyAdmin always has 100 Results, because it seems the disk percent is not used in the Query.

Assumption:
The "Disk Percent" is not taken from the "ExtremalUSB" but instead of the "Default" and then used in the Query.
So when Default hits 80%... it keeps deleting from "ExtermalUSB" until the Default is back below 70% (what is Random, because it is only the system drive.

So Question is:
How is "Disk Percent" determined, and from which drive the percent will taken? How To specify "If ExternlUSB > 80%" ?
kibbling
Posts: 20
Joined: Fri Oct 07, 2022 12:45 pm

Re: Please help with Purge filter

Post by kibbling »

Found this snippet in Filter.php

case 'DiskPercent':
// Need to specify a storage area, so need to look through other terms looking for a storage area, else we default to ZM_EVENTS_PATH
if ( ! $StorageArea ) {
for ( $j = 0; $j < count($terms); $j++ ) {
if ( isset($terms[$j]['attr']) and $terms[$j]['attr'] == 'StorageId' and isset($terms[$j]['val']) ) {
$StorageArea = new Storage($terms[$j]['val']);
break;
}
} // end foreach remaining term
if ( ! $StorageArea ) $StorageArea = new Storage();
} // end no StorageArea found yet
$sqlValue = getDiskPercent($StorageArea);
break;

But I can not find a similar logig in .pl files used in "zmfilter.pl". Seems this is only implemented in the preview in PHP and not in the actual Filter execution cronjob?
dougmccrary
Posts: 1314
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Please help with Purge filter

Post by dougmccrary »

What size does zm show in the options page for USB disk?

You're right, list matches doesn't work for purge filters.

What happens if you set the filter to 90?

What does your default filter look like? It must specify default.
kibbling
Posts: 20
Joined: Fri Oct 07, 2022 12:45 pm

Re: Please help with Purge filter

Post by kibbling »

dougmccrary wrote: Thu Feb 23, 2023 10:17 am
Thank you for reading my issue.

>What size does zm show in the options page for USB disk?
2 ExternalUSB /var/usbplatte1/zoneminder local Medium 1.73TB of 3.58TB 9825 using 0.92TB


>What happens if you set the filter to 90?
I can try it, but it will take a few month to see the result.

>What does your default filter look like? It must specify default.
There is no other filer.
I have the default "Update DiskSpace" and changed the default "Purge when Full" to this new drive.
Only those two are there.
kibbling
Posts: 20
Joined: Fri Oct 07, 2022 12:45 pm

Re: Please help with Purge filter

Post by kibbling »

Idea/Qustion:
Do I need to build a "Update DiskSpace" Filter also for each drive in order to work properly? Currently the "Update DiskSpace" is wihtout disk name. Is it then updating all or only default?
dougmccrary
Posts: 1314
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Please help with Purge filter

Post by dougmccrary »

Probably.
I have a purge filter and diskspace filter for each drive. Seems to be required, and I think is consistent with that code you found.

Your disk in Storage looks OK.
User avatar
iconnor
Posts: 3126
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Please help with Purge filter

Post by iconnor »

You should not need a storage specification for update disk space. It cares not about the storage area.
dougmccrary
Posts: 1314
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Please help with Purge filter

Post by dougmccrary »

And so it is. Just verified that one disk space filter does both my drives.
Post Reply