#!/usr/athena/bin/perl $ping = '/usr/sbin/ping'; $vos = '/mit/kolya/ops/cell/openafs/src/volser/vos'; $cell = $ARGV[0]; die "Usage: cell-df.pl cellname\n" if $cell eq ''; open (LISTADDR, "$vos listaddr -c $cell -nores -noauth |"); while () { s/[\r\n]*$//; @addrs = (@addrs, $_); } close (LISTADDR); foreach $srv (@addrs) { print "Trying $srv..\n"; $q = system ("$ping $srv 2>/dev/null >/dev/null"); next unless $q == 0; open (PARTINFO, "$vos partinfo $srv -noauth |"); while () { # Free space on partition /vicepa: 18720968 K blocks out of total 34404628 next unless /Free space on partition \/vicep(\w+): (\d+) K blocks out of total (\d+)/; $part = $1; $free = $2; $total = $3; write; $- = 500; $all_free += $free; $all_total += $total; } close (PARTINFO); } $srv = 'TOTAL'; $part = ''; $free = $all_free; $total = $all_total; write; format STDOUT_TOP = Server | Part | Total space | Free space ----------------+------+-----------------+------------------- . format STDOUT = @<<<<<<<<<<<<<< | @<<< | @<<<<<<<<<<<<<< | @<<<<<<<<<<<<<<<< $srv, $part, $total, $free .