On Tue, 5 Apr 2005 15:51:55 -0500 Erik Anderson <erikerik at gmail.com> wrote: > On Apr 5, 2005 3:36 PM, Josh Trutwin <josh at trutwins.homeip.net> > wrote: > > I've been thinking of writing one of my own, but instead of > > re-inventing the wheel I was wondering if anyone had a simple > > shell/perl/php/whatever script they'd be willing to share that > > simply does a weekly df report and also can be run hourly to check > > if any of the partitions are over XX percent and send an email > > notification. > > This isn't exactly what you're looking for, but with a bit of > modification, it could be easily modified to send notifications. I > run it on a few of my servers. > > http://phpsysinfo.sourceforge.net/ Thanks for the suggestion, I'd seen this before, it's nice to have. For the reporting feature, I just wrote a simple Perl program, it was pretty easy: #!/usr/bin/perl # report on the disk space usage over a certain threshold use strict; my $threshold = 80; # partitions using over this percent of space will cause an email warning my $message = ''; open (DF, "/bin/df -h |"); my $i = 0; while (<DF>) { chomp; if ($i > 0) { # ignore first header line my ($fs, $size, $used, $avail, $usep, $mount) = split(' ', $_); $usep =~ s/%//g; if ($usep > $threshold) { $message .= "Warning: $mount disk usage ($usep%) is greater than $threshold% - Size: $size Used: $used Avail: $avail\n"; } } $i++; } close (DF); print $message; # ./df_checker.pl Warning: /usr disk usage (82%) is greater than 80% - Size: 50G Used: 41G Avail: 9.4G Now I'll just stick this in cron. Josh