Commit de005479 authored by Fulvio Galeazzi's avatar Fulvio Galeazzi
Browse files

2021-11-19: FG; Update script as per change in output format of 'df detail'.

parent 8d422491
......@@ -159,12 +159,13 @@ foreach my $_line (@_data)
$skipNext = 1;
next;
}
$_line =~ s/^\s+//;
my @fields = split(/\s+/, $_line);
if ($_line =~ m/TOTAL/) {
$skipNext = 1;
if ($inGlobal) {
$poolHash{'GLOBAL'}{'size'} = convertNumber($fields[8].$fields[9],'size');
$poolHash{'GLOBAL'}{'frac'} = $fields[10];
$poolHash{'GLOBAL'}{'size'} = convertNumber($fields[7].$fields[8],'size');
$poolHash{'GLOBAL'}{'frac'} = $fields[9];
### In Nautilus, total number of objects is not available
# $poolHash{'GLOBAL'}{'objs'} = convertNumber($fields[5],'count');
# print "GLOBAL: ".$poolHash{'GLOBAL'}{'size'}." ".$poolHash{'GLOBAL'}{'frac'}." ".$poolHash{'GLOBAL'}{'objs'}."\n" if (defined $opt_debug);
......@@ -174,33 +175,33 @@ foreach my $_line (@_data)
}
}
# if we get here, we are in POOLS section
next if ($poolName eq "" || ($fields[1] !~ m/$poolName/));
next if ($matchStr && ($fields[1] !~ m/$matchStr/));
next if ($poolName eq "" || ($fields[0] !~ m/$poolName/));
next if ($matchStr && ($fields[0] !~ m/$matchStr/));
my $poolTest = "___";
if ($doGroup) {
my @poolfields = split(/\./, $fields[1]);
my @poolfields = split(/\./, $fields[0]);
$poolTest = $poolfields[0] if ($poolfields[0]);
} else {
$poolTest = $fields[1];
$poolTest = $fields[0];
}
if (exists $poolHash{$poolTest}) {
$poolHash{$poolTest}{'used'} += convertNumber($fields[4].$fields[5],'size');
$poolHash{$poolTest}{'size'} += convertNumber($fields[7].$fields[8],'size');
my $tempFrac = $fields[9];
my $tempMax = convertNumber($fields[10].$fields[11],'size');
$poolHash{$poolTest}{'used'} += convertNumber($fields[3].$fields[4],'size');
$poolHash{$poolTest}{'size'} += convertNumber($fields[6].$fields[7],'size');
my $tempFrac = $fields[8];
my $tempMax = convertNumber($fields[9].$fields[10],'size');
$tempMax = $poolHash{$poolTest}{'used'}/$tempFrac/0.01 if ($tempFrac > 1.);
$poolHash{$poolTest}{'max'} = $tempMax unless ($poolHash{$poolTest}{'max'} > $tempMax);
if ( $poolHash{$poolTest}{'max'} > 0. ) {
$poolHash{$poolTest}{'frac'} = $poolHash{$poolTest}{'used'} / $poolHash{$poolTest}{'max'};
}
$poolHash{$poolTest}{'objs'} += convertNumber($fields[6],'count');
$poolHash{$poolTest}{'objs'} += convertNumber($fields[5],'count');
} else {
$poolHash{$poolTest}{'used'} = convertNumber($fields[4].$fields[5],'size');
$poolHash{$poolTest}{'size'} = convertNumber($fields[7].$fields[8],'size');
$poolHash{$poolTest}{'frac'} = $fields[9];
$poolHash{$poolTest}{'max'} = convertNumber($fields[10].$fields[11],'size');
$poolHash{$poolTest}{'used'} = convertNumber($fields[3].$fields[4],'size');
$poolHash{$poolTest}{'size'} = convertNumber($fields[6].$fields[7],'size');
$poolHash{$poolTest}{'frac'} = $fields[8];
$poolHash{$poolTest}{'max'} = convertNumber($fields[9].$fields[10],'size');
$poolHash{$poolTest}{'max'} = $poolHash{$poolTest}{'used'}/$poolHash{$poolTest}{'frac'}/0.01 if ($poolHash{$poolTest}{'frac'} > 1.);
$poolHash{$poolTest}{'objs'} = convertNumber($fields[6],'count');
$poolHash{$poolTest}{'objs'} = convertNumber($fields[5],'count');
}
print "POOL: $poolTest ".$poolHash{$poolTest}{'used'}." ".$poolHash{$poolTest}{'max'}." ".$poolHash{$poolTest}{'size'}." ".$poolHash{$poolTest}{'frac'}." ".$poolHash{$poolTest}{'objs'}."\n" if (defined $opt_debug);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment