I had to search, but I had written this Perl script for automatic notification if the filesystem was greater than some arbirtary percentage:
#!/usr/bin/perl
# auswipe, 5 Apr 2002
# Tested under OpenBSD 2.9
# auswipe sez : "No guarantees!"
$upperLimit = 80; # Upper Limit in % for a File System
$mailTarget = "joe\@blow.com"; # Target for the automatic e-mail message
open(STATS, "df -h\|grep '%'|") || die "$!";
my @fileStats = <STATS>;
foreach $entryLine (@fileStats) {
chomp($entryLine);
$entryLine =~ s/\s+/ /g;
my @fsStats = split(/ /, $entryLine);
$fsStats[4] =~ s/%//g;
if ($fsStats[4] >= $upperLimit) {
open(MAIL, "|mail -s \"FileSystem $fsStats[0] Getting Full!\" $mailTarget ") || die "Can't open m
ail!";
select(MAIL);
print << "EOF";
The FileSystem $fsStats[0] is getting full.
Currently, the file system is ${fsStats[4]}% full. The upper
limit has been placed at ${upperLimit}%.
Please attend to this matter.
-auswipe
This message has been created automatically. Please do not respond to this message.
EOF
close(MAIL);
};
};
close(STATS);