Dear Steve,

thanks a lot for your tool. Small problem: if a server currently has no 
partitions, you'll get a division by zero when calculating $pct. You'll find a 
simple patch enclosed. (Formatting is done to keep the patch small. There 
should be an additional indentation to all lines inside the new if{} clause for 
sure.)

New output:

lnx-14        a         9        1        8    10.67%
              b         9        0        9     1.20%
              c         9        4        5    40.88%
              d         9        4        5    47.01%
   Subtotal            39        9       29    24.95%

lnx-16        -

lnx-17        -

lnx-18        a         9        0        9     0.85%


Kind regards,

Ado Arnolds

On 09.05.2017 19:23, Steve Simmons wrote:
> ​About 10 years back I posted a 'afsdf' command to openafs-info. Many 
> improvements were made based on suggestions here, but I never got round to 
> re-posting it. In general, the command does a df-ish disk usage report across 
> an entire cell, with various permutations on roll-ups, display compaction, 
> and so forth. Used in my favorite two modes:
> 
> $ afsdf -t
> Server                Ptn       SizeMB         Used       Avail.  Pct Full
> ====================  ===  ===========  ===========  ===========  ========
> afsprs01.afs.storage   a     2,096,124    1,669,362      426,761    79.64%
> afsprs01.afs.storage   b     2,096,124    1,638,733      457,390    78.18%
> afsprs01.afs.storage   c     2,096,124    1,686,377      409,746    80.45%
> afsprs01.afs.storage   d     2,096,124    1,703,729      392,394    81.28%
> afsprs01.afs.storage   e     2,096,124    1,670,024      426,099    79.67%
> afsprs01.afs.storage   f     2,096,124    1,716,652      379,471    81.90%
> afsprs02.afs.storage   a     2,096,124    1,701,536      394,587    81.18%
> afsprs02.afs.storage   b     2,096,124    1,711,506      384,617    81.65%
> . . .
> afsprs10.afs.storage   e     2,096,124    1,385,650      710,473    66.11%
> afsprs10.afs.storage   f     2,096,124    1,355,564      740,559    64.67%
> ====================  ===  ===========  ===========  ===========  ========
>          Grand Total       125,767,440   97,068,722   28,698,717    77.18%
> 
> $ afsdf -T -s -u GB
> Server       Ptn   SizeGB     Used   Avail.  Pct Full
> ===========  ===  =======  =======  =======  ========
> afsprs01      a     2,046    1,630      416    79.64%
>               b     2,046    1,600      446    78.18%
>               c     2,046    1,646      400    80.45%
>               d     2,046    1,663      383    81.28%
>               e     2,046    1,630      416    79.67%
>               f     2,046    1,676      370    81.90%
>    Subtotal        12,281    9,848    2,433    80.19%
> 
> afsprs02      a     2,046    1,661      385    81.18%
>               b     2,046    1,671      375    81.65%
> . . .
> afsprs10      a     2,046    1,373      673    67.11%
>               b     2,046    1,355      691    66.24%
>               c     2,046    1,345      701    65.71%
>               d     2,046    1,377      669    67.29%
>               e     2,046    1,353      693    66.11%
>               f     2,046    1,323      723    64.67%
>    Subtotal        12,281    8,129    4,152    66.19%
> ===========  ===  =======  =======  =======  ========
> Grand Total       122,819   94,793   28,026    77.18%
> 
> 
> afsdf -h prints a quick help message, afsdf --usage shows you all the 
> switches.
> 
> Enjoy,
> 
> Steve
> 
--- afsdf.orig	2017-05-10 16:10:01.000000001 +0200
+++ afsdf	2017-05-10 16:29:31.000000001 +0200
@@ -471,7 +471,7 @@
 	    print "\n" if ( $subtotal_done );
 	}
 	open( FSDATA, "vos partinfo -server $server $cellflag -noauth |" );
-	@fsdata = ( <FSDATA> );
+	if ( @fsdata = ( <FSDATA> ) ) {
 	foreach $line ( @fsdata ) {
 	    # All calculation is done in the native server units, KB.
 	    # We scale them as requested when printing.
@@ -508,6 +508,9 @@
 		    $pct, mk_flag( $pct ) );
 	    $subtotal_done = 1;
 	}
+    } else {
+	printf "%-${srv_width}.${srv_width}s   -\n", $servname;
+    }
     }
     if ( 0 == $gtot_size ) {
 	$pct = 0;

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to