Show %used in mogadm device summary [patch]

1 view
Skip to first unread message

Justin Huff

unread,
Jun 11, 2009, 4:48:04 PM6/11/09
to mogile
I like to see a the %used on a host. Also, any thoughts on changing
the --status default from alive,readonly to alive,readonly,drain?


diff -u mogadm.orig mogadm
--- mogadm.orig 2009-06-11 13:41:58.926354336 -0700
+++ mogadm 2009-06-11 13:44:43.403608551 -0700
@@ -852,7 +852,7 @@
my $devs = devices();
fail_text('no_devices') unless $devs;

- printf "%-15s %6s %7s %8s %8s %8s\n", 'Hostname', 'HostID',
'Status', 'used(G)', 'free(G)', 'total(G)';
+ printf "%-15s %6s %7s %8s %8s %8s %8s\n", 'Hostname', 'HostID',
'Status', 'used(G)', 'free(G)', 'total(G)', '%used';
foreach my $hostid (sort keys %$hosts) {
my $host = $hosts->{$hostid};
my ($total,$used) = (0, 0);
@@ -869,7 +869,9 @@
}
my $free = $total - $used;
printf "%-15s [%4d]: %6s", $host->{hostname}, $hostid, $host->{status};
- printf " %8.3f %8.3f %8.3f\n", $used, $free, $total;
+ printf " %8.3f %8.3f %8.3f ", $used, $free, $total;
+ printf "%8.2f", 100*$used/$total if $total;
+ print "\n"
}

ok();

dormando

unread,
Nov 24, 2009, 4:19:44 AM11/24/09
to mogile
Hey,

Finally committed this. I'm not sure what you meant by the --status
default though, sorry :(
Reply all
Reply to author
Forward
0 new messages