Accumulated changes of past half year:
configure: Use /usr/bin/bdf if exists quotacheck: round free space to 1 decimal place. quotastat: print to different file each month.
This commit is contained in:
parent
22a64b0dd2
commit
20cad3f629
|
@ -27,7 +27,7 @@ echo " -e 's,@@@perl@@@,$perl,g' \\" >> customize
|
|||
################################################################
|
||||
# find a working df:
|
||||
#
|
||||
for i in /bin/df /usr/bin/df /usr/sbin/df /usr/local/bin/df
|
||||
for i in /bin/df /usr/bin/df /usr/bin/bdf /usr/sbin/df /usr/local/bin/df
|
||||
do
|
||||
a=`$i | awk 'NR == 1 {print $2}'`
|
||||
if [ "$a" = "kbytes" -o "$a" = "1024-blocks" ]
|
||||
|
@ -51,6 +51,7 @@ then
|
|||
fi
|
||||
echo " -e 's,@@@df@@@,$df,g' \\" >> customize
|
||||
|
||||
|
||||
################################################################
|
||||
# find repquota:
|
||||
# We don't try to check whether the output is useful,
|
||||
|
|
|
@ -17,6 +17,7 @@ sub warnmsg {
|
|||
$wo = "$mount (Host $hostname)";
|
||||
}
|
||||
|
||||
|
||||
my $msg = "Sie haben auf $wo Ihr in Disk Quotas gesetztes Limit\n" .
|
||||
"überschritten. ";
|
||||
|
||||
|
@ -26,7 +27,7 @@ sub warnmsg {
|
|||
$grace =~ s/days/Tage/g;
|
||||
$grace =~ s/hours/Stunden/g;
|
||||
$msg .= "Sie können noch " .
|
||||
($hard - $usage) . " $unit anlegen.\n" ;
|
||||
(int (($hard - $usage) * 10 + 0.5) / 10) . " $unit anlegen.\n" ;
|
||||
}
|
||||
$msg .= "\nBei dringendem Bedarf können Sie sofort zusätzlichen Platz schaffen,\n" .
|
||||
"indem Sie auf $wo Files löschen, komprimieren oder auf eine\n" .
|
||||
|
|
|
@ -2,7 +2,14 @@
|
|||
|
||||
$hostname=`hostname`;
|
||||
chomp($hostname);
|
||||
$date=`date '+%Y-%m-%dT%H:%M:%S'`;
|
||||
($sec, $min, $hour, $day, $mon, $year) = localtime(time);
|
||||
$year += 1900;
|
||||
$mon += 1;
|
||||
|
||||
$yearmon=sprintf("%4d-%02d",
|
||||
$year, $mon);
|
||||
$datetime=sprintf("%4d-%02d-%02dT%02d:%02d:%02d",
|
||||
$year, $mon, $day, $hour, $min, $sec);
|
||||
chomp($date);
|
||||
open (DF, "@@@df@@@ |") or die "cannot call @@@df@@@: $!";
|
||||
|
||||
|
@ -15,7 +22,7 @@ $/ = $fs;
|
|||
$df =~ s/\n[ \t]+/ /mg;
|
||||
@df = split(/\n/, $df);
|
||||
|
||||
open (STAT, ">>/usr/local/dfstat/quota.stat") or die "cannot append to quota.stat";
|
||||
open (STAT, ">>/usr/local/dfstat/quota.stat.$yearmon") or die "cannot append to quota.stat.$yearmon";
|
||||
for $ln (@df) {
|
||||
($fs, $total, $used, $free, $pct, $mount) = split(/\s+/, $ln);
|
||||
if ($fs =~ m|^/dev/| and -f "$mount/quotas") {
|
||||
|
@ -28,7 +35,7 @@ for $ln (@df) {
|
|||
(\d+)\s+(\d+)\s+(\d+)\s+(|NOT\sSTARTED|EXPIRED|\d+\.\d+\ (?:days|hours))\s+
|
||||
(\d+)\s+(\d+)\s+(\d+)\s+(|NOT\sSTARTED|EXPIRED|\d+\.\d+\ (?:days|hours))
|
||||
/x) {
|
||||
print STAT "$date\t$mount\t$1\t$2\t$3\t$4\t$6\t$7\t$8\n";
|
||||
print STAT "$datetime\t$mount\t$1\t$2\t$3\t$4\t$6\t$7\t$8\n";
|
||||
} else {
|
||||
print "unparseable: $_";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue