Skip to content

Commit

Permalink
mogadm check shows "N/A" util on hosts w/o iostat
Browse files Browse the repository at this point in the history
Instead of falsely reporting zero I/O utilization, this helps
admins detect broken configurations where iostat reporting is
not available or misconfigured

Tested on both a properly configured cluster and a misconfigured
cluster (which I'm sad to admit I have one lying around :x).

ref: http://code.google.com/p/mogilefs/issues/detail?id=9
  • Loading branch information
Eric Wong authored and dormando committed Aug 12, 2012
1 parent 9b17a73 commit 4912350
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mogadm
Original file line number Diff line number Diff line change
Expand Up @@ -507,12 +507,15 @@ sub cmd_check {
$total{avail} += $data{avail};
$total{total} += $data{total};

$dev->{utilization} = 0 if (!defined($dev->{utilization}) ||
$dev->{utilization} !~ /\A\d+(\.\d+)?\Z/);
printf(" %10.3f %10.3f %10.3f %6.2f%% %-7s %5.1f\n",
my $util = "N/A";
if (defined($dev->{utilization}) && $dev->{utilization} =~ /\A\d+(\.\d+)?\Z/) {
$util = sprintf("%.1f", $dev->{utilization});
}

printf(" %10.3f %10.3f %10.3f %6.2f%% %-7s %5s\n",
(map { $data{$_} } qw(total used avail)),
$pct, ($dev->{observed_state} || "?"),
$dev->{utilization});
$util);
}
}
my $pct = 0;
Expand Down

0 comments on commit 4912350

Please sign in to comment.