Folder AND sub folder size : which component?

Hi,

I’m looking for a way to monitor the size Zoneminder video are occupying.
On my server, they are stored in /usr/share/zoneminder/www/events, with a subfolder for each camera, each one having a date-based tree.

If I use the systemmonitor component, disk_use_percent, it shows me the whole filesystem size, in this case /usr. I can monitor it, but it changes for several other reasons beyong ZM only.

If I use the folder sensor component, it will only show me the files directly in the folder, not the size of the sub-folders.

First component is a “df” command, second one is a “ls” while I would expect it to be a “du -sm folder/.”

a shell_command?
http://www.lmgtfy.com/?q=linux+command+line+folder+size+recursive :slight_smile:

Lazy as I am, I was more expecting a “recursive: true” option for the folder component :wink:

2 Likes

After waiting for +2 years you finally deserve that somebody does the work for you…

:rofl:
Totally forgot about that, and about the sensors I finally made, a few months (?) after. But soon, Zoneminder came with h264 storage instead of jpeg files, saving a lot of space. So they are there but I don’t use them at all anymore !
I didn’t use neither the multiply nor the round : multiply ain’t needed if you use the du options to get result in MiB, and I didn’t care about format as it was for cleaning/alerting purpose, not showing :

  - platform: command_line
    name: Events size RdC
    command: "du -sm /usr/share/zoneminder/www/events/3 | awk '{print $1}'"
    unit_of_measurement: "MB"

1 Like