Xymon Mailing List Archive search

using hobbit to monitor the number of files

3 messages in this thread

list Dan Simoes · Fri, 2 Feb 2007 15:17:07 -0800 ·
Say, in a mail or print spool.  I know hobbit can check the age or existence
of a file, but how about the number of files in a dir?

I'm sure it's trivial to do, but I haven't run across this yet, so before I
reinvent the wheel, I thought I'd ask.

I would like hobbit to report on the number of files in a given location,
and then generate an alert if it's above the warning or fatal levels.

Thanks.
list Henrik Størner · Sat, 3 Feb 2007 17:09:15 +0100 ·
quoted from Dan Simoes
On Fri, Feb 02, 2007 at 03:17:07PM -0800, Dan Simoes wrote:
Say, in a mail or print spool.  I know hobbit can check the age or existence
of a file, but how about the number of files in a dir?
Why didn't I think of that when I wrote the client code? You can check
on the disk space a given directory occupies, but not the count of
files.

As you say, it should be trivial to implement. Hobbit already has the
mechanism in place to "count" lines in a logfile, so adding
file-counting should be a no-brainer.


Regards,
Henrik
list Dean Casey · Tue, 6 Feb 2007 09:51:21 -0500 ·
Should be simple enough to write a shell script for that. 

$variable=`ls <directory name> |  wc -l` will work on Solaris and
RedHat. Just get the value of $variable.

Dean Casey
quoted from Dan Simoes


From: Dan Simoes [mailto:user-3428f00c5f40@xymon.invalid] 
Sent: Friday, February 02, 2007 6:17 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: [hobbit] using hobbit to monitor the number of files

 
Say, in a mail or print spool.  I know hobbit can check the age or
existence of a file, but how about the number of files in a dir?

I'm sure it's trivial to do, but I haven't run across this yet, so
before I reinvent the wheel, I thought I'd ask. 

I would like hobbit to report on the number of files in a given
location, and then generate an alert if it's above the warning or fatal
levels.

Thanks.