From fc8994f63f763ea6e783c19c41ffe1c7de780ce2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 14 Apr 2013 01:14:57 +0000 Subject: [PATCH] mogadm: improve "device list" formatting With multi-terabyte disks being commong nowadays, the formatting of "mogadm device list" output has become cramped and hard-to-read. Additionally, right justifying numeric values makes identifying order-of-magnitude differences between rows easier: before: used(G) free(G) total(G) weight(%) dev11: alive 1267.246 1483.296 2750.542 100 dev2: alive 1196.321 637.334 1833.655 100 dev5: alive 1220.643 154.568 1375.211 100 dev6: alive 2072.875 677.667 2750.542 100 dev7: alive 995.188 380.022 1375.211 100 after: used(G) free(G) total(G) weight(%) dev11: alive 1267.246 1483.296 2750.542 100 dev2: alive 1196.321 637.334 1833.655 100 dev5: alive 1220.643 154.568 1375.211 100 dev6: alive 2072.875 677.667 2750.542 100 dev7: alive 995.188 380.022 1375.211 100 --- mogadm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mogadm b/mogadm index 0bb7764..61b47a2 100755 --- a/mogadm +++ b/mogadm @@ -824,7 +824,7 @@ sub cmd_device_list { } print "$host->{hostname} [$hostid]: $host->{status}\n"; - printf "%6s %-10s %7s %7s %7s %7s\n", '', '', 'used(G)', 'free(G)', 'total(G)', 'weight(%)'; + printf "%7s %-7s %10s %10s %10s %10s\n", '', '', 'used(G)', 'free(G)', 'total(G)', 'weight(%)'; foreach my $devid (sort keys %{$devs->{$hostid} || {}}) { my $dev = $devs->{$hostid}->{$devid}; next if $dev->{status} eq "dead" && ! $args->{all}; @@ -832,7 +832,7 @@ sub cmd_device_list { my $total = $dev->{mb_total} / 1024; my $used = $dev->{mb_used} / 1024; my $free = $total - $used; - printf "%6s: %-10s %-7.3f %-7.3f %-7.3f % 3u\n", "dev$devid", $dev->{status}, $used, $free, $total, $dev->{weight}; + printf "%7s: %7s %10.3f %10.3f %10.3f %10u\n", "dev$devid", $dev->{status}, $used, $free, $total, $dev->{weight}; } print "\n";