use Win32::AdminMisc;
use Mail::Sendmail;
use strict;
my ($total, $free, %mail,
       $machine, $drive, $low,
       $to, $from, # Email addresses
       );
$machine = 'OvertaxedMachine';
$drive = "c:/";
$low = 50000000; # 50MB
$to = '[email protected]';
$from = "$machine\@foobarcom";

my $VERSION = 0.15;

while (sleep 43200)     { # Check every 12 hours
       ($total, $free) = Win32::AdminMisc::GetDriveSpace($drive);
       print "$free bytes remaining\n";

       if ($free < $low)       {
               %mail = (To => $to,
                       From => $from,
                       Subject => "$machine low on disk space",
                       Message => "$machine is low on disk space again.
                                               ($free bytes remaining.)"
           );
           sendmail(%mail) or die $Mail::Sendmail::error;
       }  # End if;
}  #  Wend

=head1 NAME

disklow - Send notification of low disk space.

=head1 DESCRIPTION

There are several products on the market that send notification of
low disk space, but most of them are not free. This monitors disk space
at regular intervals, and sends email if space gets low.

=head1 README

Sends email notification of low disk space

=head1 PREREQUISITES

       Win32::AdminMisc
       Mail::Sendmail

=head1 COREQUISITES

None

=pod OSNAMES

MSWin32

=pod SCRIPT CATEGORIES

Win32

=cut