File: [local] / wpscripts / wpfreespace / wpfs.pl (download)
Revision 1.2, Wed Dec 21 09:36:14 2011 UTC (12 years, 6 months ago) by yason
Branch: MAIN
CVS Tags: HEAD Changes since 1.1: +2 -2 lines
update to current reality
|
#!/usr/bin/perl
use smtp;
our $CRITSIZPERC = '90'; # in percents %
our @VOLUMES = ('/mnt/maket', '/mnt/archive', '/mnt/rmt_maket');
our $DF = '/bin/df -h';
our $AWK = '/usr/bin/awk \'{print $5}\'';
our $MAILTO = 'admin@mb13.ru';
our $fperc;
our $mp;
for ($mp = 0; $mp < scalar(@VOLUMES); $mp++)
{
$fperc = `$DF $VOLUMES[$mp] | $AWK`;
$fperc = (split('\n', $fperc))[1];
$fperc = (split('%', $fperc))[0];
if($fperc > $CRITSIZPERC)
{
print "Free space low on $VOLUMES[$mp] ($fperc% used) ";
smtp::email($MAILTO, $VOLUMES[$mp], $fperc);
print "mail sent\n";
}
}