Check size of large directory

Gavin Carr gavin at openfusion.com.au
Fri Dec 3 18:10:29 CET 2010


On Fri, Dec 03, 2010 at 07:29:54AM +0100, Sebastian Ries wrote:
>> The check_folder_size.sh script will probably suit your needs well.
>
>Yes, I found scripts for this.
>The Problem is that a du within this folder takes about 2 minutes.
>That's why I told that it is a very large directory with many files)
>
>The other side is that the content within this directory is generated
>once a day so I wanted to run the "du" after generating the content of
>the file and let nagios just check the result that was written in a
>file.

I'd put the starts in your calculation script e.g.

   DIR=/path/to/BIGDIR
   FLAG=$DIR/EEK_TOO_BIG
   LIMIT=12345678

   rm -f $FLAG || exit 3
   DIRSIZE=$(du -s $DIR | sed 's/\t.*$//')
   test $DIRSIZE -ge $LIMIT && touch $FLAG

or whatever i.e. have your calc script check the limits and
touch a file to signal that there's a problem. Your actual
nagios test is then trivial.

Cheers,
Gavin



------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list