use strict ; use warnings ;
# call:
# perl check-mount-disk-usage.pl | head -n 1
# perl check-mount-disk-usage.pl | sort -k 2rn
use Filesys::DfPortable ;
use Sys::Filesystem ();
printf "%-15s %10s %10s %10s %10s %10s \n" , "Mount" , "Usage in %"
, "Used MB" , "Total MB" , "Available MB" , "Free MB" ;
my $fs = Sys::Filesystem->new();
my @filesystems = $fs->filesystems();
for my $filesystem ( @filesystems ) {
my $mount = $fs->mount_point($filesystem) ;
my $ref = dfportable("$mount", (1024*1024)); # Display output in 1K blocks
if(defined($ref)) {
printf "%-15s %10d %10d %10d %10d %10d \n" , $mount ,
$ref->{per} , $ref->{bused} , $ref->{blocks} , $ref->{bavail} , $ref->{bfree} ;
} #eof if
} #eof while
1 ;
__END__
=cut
Purpose:
OS independant mount points space usage
Author: ysg
License: Free BSD
Requirements:
perl -MCPAN -e "install Filesys::DfPortable"
perl -MCPAN -e "install Sys::Filesystem"
=pod
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!