Fixed parsing of repquota output for Linux.

This commit is contained in:
hjp 2004-10-08 10:20:24 +00:00
parent 934b8a9eb6
commit 9d6f178d2e
1 changed files with 6 additions and 5 deletions

View File

@ -25,20 +25,21 @@ $df =~ s/\n[ \t]+/ /mg;
open (STAT, ">>/usr/local/dfstat/quota.stat.$yearmon") or die "cannot append to quota.stat.$yearmon"; open (STAT, ">>/usr/local/dfstat/quota.stat.$yearmon") or die "cannot append to quota.stat.$yearmon";
for $ln (@df) { for $ln (@df) {
($fs, $total, $used, $free, $pct, $mount) = split(/\s+/, $ln); ($fs, $total, $used, $free, $pct, $mount) = split(/\s+/, $ln);
if ($fs =~ m|^/dev/| and -f "$mount/quotas") { if ($fs =~ m|^/dev/|) {
open REPQUOTA, "@@@repquota@@@ $mount |" or die "cannot call @@@repquota@@@: $!"; open REPQUOTA, "@@@repquota@@@ $mount 2>/dev/null |" or die "cannot call @@@repquota@@@: $!";
while (<REPQUOTA>) { while (<REPQUOTA>) {
$msg = ""; $msg = "";
if (!/\d+/) { if (!/\b\d+\b/) {
#print "header: $_"; #print "header: $_";
} elsif (/(\w+) \s+ [-+][-+] \s* } elsif (/(\w+) \s+ [-+][-+] \s*
(\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))\s+
(\d+)\s+(\d+)\s+(\d+)\s+(|NOT\sSTARTED|EXPIRED|\d+\.\d+\ (?:days|hours)) (\d+)\s+(\d+)\s+(\d+)\s+(|NOT\sSTARTED|EXPIRED|\d+(?:\.\d+)?\ ?(?:days|hours))
/x) { /x) {
print STAT "$datetime\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 { } else {
print "unparseable: $_"; print "unparseable: $_";
} }
} }
close(REPQUOTA);
} }
} }