#!/usr/bin/perl -T -I /h/COE/lib -w

use Coe;

my @data;
my $dev;
my $total;
my $used;
my $avail;
my $res;
my $dir;

@data=coeExec("/bin/df -k");
shift (@data);

# deb has a default 5% reserve; use tune2fs -m 
# sol has a default 10% reserve; use tunefs -m 
foreach (@data) {
	chomp();
	$_=cleanString($_,3);
	@d = split();
	$dev=$d[0];
	$total=$d[1];
	$used=$d[2];
	$avail=$d[3];
	$res=(($total-$avail-$used)*100)/$total+0.5;
	$dir=$d[5];
	# This is a weak attempt to lure the sysad to install on h
	# I should drop this quickly when the install anywhere initiative is over
	if ("$dir" eq "/") {$dir="/h"};

	printf "%s:%d:%d:%d:%d%s:%s\n", $dev, $total, $used, $avail, $res,"%", $dir;
}