#!/usr/bin/perl # # SmoothWall CGIs # # This code is distributed under the terms of the GPL # # (c) The SmoothWall Team # # use strict; # enable only the following on debugging purpose use warnings; use CGI::Carp 'fatalsToBrowser'; require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; require "${General::swroot}/graphs.pl"; #workaround to suppress a warning when a variable is used only once my @dummy = ( ${Header::colourred} ); undef (@dummy); my %cgiparams=(); &Header::showhttpheaders(); &Header::getcgihash(\%cgiparams); &Header::openpage($Lang::tr{'media information'}, 1, ''); &Header::openbigbox('100%', 'left'); my @devices = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`; foreach (@devices) { my $device = $_; chomp($device); &Graphs::updatediskgraph ("day",$device); diskbox("$device"); } &Header::openbox('100%', 'center', $Lang::tr{'disk usage'}); print "
$Lang::tr{'device'} | $Lang::tr{'mounted on'} | $Lang::tr{'size'} | $Lang::tr{'used'} | $Lang::tr{'free'} | $Lang::tr{'percentage'} | END ; } else { my ($device,$size,$used,$free,$percent,$mount) = split; print <$device | $mount | $size | $used | $free |
END
;
&percentbar($percent);
print <$percent |
END
;
}
}
close DF;
print " \n | Inodes\n"; open(DF,'/bin/df -i -x rootfs|'); while($Lang::tr{'device'} |
$Lang::tr{'mounted on'} |
$Lang::tr{'size'} |
$Lang::tr{'used'} |
$Lang::tr{'free'} |
$Lang::tr{'percentage'} |
$device |
$mount |
$size |
$used |
$free |
END
;
&percentbar($percent);
print < | $percent |
END
;
}
}
close DF;
my @iostat1 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$1}');
my @iostat2 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$5}');
my @iostat3 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$6}');
print " \n | transfersDevice | MB read | MB writen | $iostat1[$i] | $iostat2[$i] | $iostat3[$i] | |