[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: detailed disk usage package?

Hi Zhengquan,

I send script in perl, that use for this type of disk space monitoring.

vi df.pl

# Available under BSD License. See url for more info:
# http://www.cyberciti.biz/tips/howto-write-perl-script-to-monitor-disk-space.html
use strict;
use warnings;
use Filesys::DiskSpace;
# file system to monitor
my $dir = "/home";
# warning level
my $warning_level=10;
# email setup
my $to='admin@yourdomain.com';
my $from='webmaster@YOURDOMAIN.COM';
my $subject='Low Disk Space';
# get df
my ($fs_type, $fs_desc, $used, $avail, $fused, $favail) = df $dir;
# calculate
my $df_free = (($avail) / ($avail+$used)) * 100.0;
# compare
if ($df_free < $warning_level) {
my $out = sprintf("WARNING Low Disk Space on $dir : %0.2f%% ()\n",$df_free);
# send email using UNIX/Linux sendmail
open(MAIL, "|/usr/sbin/sendmail -t");
## Mail Header
print MAIL "To: $to\\n";
print MAIL "From: $from\\n";
print MAIL "Subject: $subject\\n";
## Mail Body
print MAIL $out;


You can run this script as a cron job:

@hourly /path/to/df.pl

I expect this help.

On Mon, May 4, 2009 at 11:07 AM, Zhengquan Zhang <zhang.zhengquan@gmail.com> wrote:
Dear debian community,

I was doing du -ka . | sort -nr once in a while to do disk usage

I was wondering if anybody here are using a package that can do detailed
disk usage analysis. and the program can email a detailed report to me?

Thanks for any pointers,


To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Reply to: