#!/usr/bin/perl

$mailfrom = "notify\@bignetworks.com";
$mailto = "notify\@bignetworks.com";
$mailserver = "exchange01.bignetworks.com";

$above = 75;

use FileHandle;
use Sys::Hostname;

$host = hostname;

@check=`df -k`;

##### Checks for lines higher than $above
foreach (@check) {
	if (m/(\d+\%)/ and $1 >=$above) {
		push @New,$_;
	}
}

##### If there is anything found, send mail 
if (@New) {
	$mail = new FileHandle; 
	$mail->open("| /usr/local/bin/sendEmail.pl -f $mailfrom -t $mailto -s $mailserver -u \"$host disk space low!\"") || die "Cannot open: $!";
	$mail->print("$host: Disk space is low!\n\n");
	$mail->print(@New, "\n");
	$mail->close();
}



