Maximum number of events per monitor

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
Solar
Posts: 13
Joined: Fri Aug 18, 2006 11:11 pm
Location: South Africa

Maximum number of events per monitor

Post by Solar »

Another thing I found happening, is that if there is more than a certain number of events per monitor, Linux just can't create a new directory for a new event, and nothing for that event gets recorded anymore.

It differs on my systems, but I found a "safe" maximum number of events to be about 18 000. (EXT3 dictates that 32 000 directory objects can be created).

Will it be possible to create a NEW folder if the zma deamon receives this: maximum number of directory objects from the system? At the moment my fix is just a perl script which runs each hour to delete the oldest events if there is more than 18 000 on the system per monitor...

The best way of handling this would be to just create a new folder (and keeping track of this folder) each time a certain amount of events is exceeded (or when Linux reports an error when creating a directory).

If someone needs an interim fix I'll be glad to post the Perl script here. (It's also compatible with my ZM Clustered version).

Regards,
Christiaan
nakedfarmanimals
Posts: 20
Joined: Fri Jun 15, 2007 9:46 pm

Al-gore-rhythm...

Post by nakedfarmanimals »

It seems like this would be in the algorithm used to create and populate new directories.

Currently, it looks something like this on my install:

/usr/share/zoneminder/data/2/003/capture-0001.jpg

where /2/ is the monitor number, /003/ the event number, and then capture-0001.jpg is the frame captured (frame 1 of event 003 on monitor #2.)

If people are encountering file handle / directory object issues with having too many subdirectories or files in a given directory (tree too wide), then the algorithm should be straightforward to change (by making the tree appropriately deep after getting to be a certain width.)

For example, wrap your head around this:
/usr/share/zoneminder/data/2/0/003/capture-0001.jpg

This could represent frame 1 of event 0 003 on monitor #2.
The extra /0/ could represent a *10, *100, or *1000 value, incrementing when the 3-digit even counter flipped.

The path:
/usr/share/zoneminder/data/2/1/003/capture-0001.jpg
This could represent frame 1 of event 1003 on monitor #2.

/usr/share/zoneminder/data/2/21/003/capture-0001.jpg
This could represent frame 1 of event 21003 on monitor #2.

With the above, no single directory would have more than 100/1000 files or folders in it, getting us way below the 18000/32000 effective/hard limits of the filesystem.

In this scenario, a few elegant mod (%) and div (/) statements could work out which directory to create, write into, or look into to pull/display.

I will see if I can find the relevant routines in the php or perl code to suggest where the changes would need occur.

Hope that this helps.
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

this comes up from time to time. Ext3 has this limit but other filesystems dont. I beleive xfs doesnt have this limitation. 32k is a lot of events, id look at altering the buffers or zones to 'join' events togother
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
Post Reply