[hobbit] monitor a series of files for absolute size (alert & trending)
Henrik Stoerner
henrik at hswn.dk
Thu Aug 3 17:24:23 CEST 2006
On Thu, Aug 03, 2006 at 09:04:23AM -0400, Jerry Yu wrote:
> I need to monitor some os and db backup files for their sizes for alert
> based on absolute sizes as well as rrd trending. Does Hobbit do this now? I
> am running 4.2-RC-20060712 on CentOS 4.3/i386.
>
> A twist is the file names are timestamped (os-backup-YYYYMMDD-HHmm.star.gz).
> any suggestions/tricks? I thought of making a copy to a fixed name for
> monitoring, but it is kinda expensive due to the size of the backups
> themselves.
First thing is to get a "file:" entry in client-local.cfg to grab the
data for the latest file. Something like:
file:`ls -t -1 /backup(os-backup-*.tar.gz|head -1`
This runs the "ls -t...." command to determine the filename. Since it
uses a time-sort and grabs only the first line, it should give you the
name of the latest file.
Next you want to track the size of it. In hobbit-clients.cfg
define a FILE entry to track this - it needs to use a regex to match
the filename, and an explicit RRD id to make it always use a specific
RRD file. Perhaps you want to alert if they get bigger than 1 GB. So:
FILE %^/backup/os-backup.*.tar.gz SIZE<1G TRACK=osbackup
Other interesting options for the FILE entry might be "MTIME<86400" to
check that the latest backup file is at most 24 hours old.
[10 minutes later]
OK, I've learnt to test things before sending mails like this. The TRACK
setting for files and directories currently ignores the ID you may pass
to it, and uses the current filename when deciding on the RRD filename.
So to use this, you'll need to grab either the current snapshot and
build that, or the current "all-in-one" patch from
http://www.hswn.dk/hobbitsw/betapatches/
Regards,
Henrik
More information about the Xymon
mailing list