monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Directory Size


From: Kizito Porta Balanyà
Subject: Re: Directory Size
Date: Fri, 6 Mar 2015 12:02:17 +0100

2015-03-05 20:30 GMT+01:00  <address@hidden>:
> here's script I use to convert the number of msgs in postfix queues to bytes
> in a file
>
> (freebsd syntax)
>
> #!/bin/sh
>
> for Q in incoming active deferred hold ; do
>
> SIZE="`find /var/spool/postfix/$Q -maxdepth 5 -type f | wc -l | tr -d ' ' `"
>
> dd  if=/dev/zero bs=1 count=$SIZE of=/var/db/postfix/q_size_$Q
>
> done
>
> exit 0
>

This solution es very ingenious!
The only problem that I see is that in a big directory, it generates a
big file, but it is the price to pay.

> ================
>
> then I have monit check the file size of the q_size_*
>
> (for a tree depth = 0) :
>
> du -d0 /path/to/dir | cut -f1 >  /var/db/monit/dirname
>
> ... has the file dirname with the number of bytes in the tree at and belwow
> /path/to/dir
>
> so you monit  the file size of file /var/db/monit/dirname

Len, Are you sure you monit the file size of file /var/db/monit/dirname?
Doesn't the file /var/db/monit/dirname contains the size of the dir?


Thank you.

>
>
> Len
>
>
>
>
>
> On Thursday 05/03/2015 at 11:48 am, Kevin Chadwick wrote:
>
> On Thu, 5 Mar 2015 17:05:01 +0100
> Jan-Henrik Haukeland wrote:
>
> This is not possible with Monit’s ‘check directory’ (it would be a nice
> thing to add in the future though). One way to do this now is to use ‘check
> program’ with ‘/usr/bin/du -s <dir>’ and return a status accordingly to if a
> threshold was reached or not
>
>
> On 05 Mar 2015, at 16:11, Kizito Porta Balanyà <address@hidden> wrote:
>
> Hello,
>
> Any hint to monitor the size of a directory?
>
> Googling about it doesn't return anything that I like.
>
>
> Thanks a lot for your time.
>
> Regards.
>
>
> You could also use a partition and mount it to that folder and use disk
> usage instead but perhaps that is one of the things you don't like? You
> may be able to add mount options like noexec and nosuid though.
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general
>
>
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general



reply via email to

[Prev in Thread] Current Thread [Next in Thread]