#!/usr/bin/perl

my $loadLimit  = 8;
my $checkTimer = 60; #segundos

while (1) {

	my $load = `uptime`;
	$load =~ s/^.*age: //;
	$load =~ s/,.*$//;
	chomp($load);

	if ($load>$loadLimit) {
		print "load alto: $load\n";
		system("echo Subject: LOAD\nload alto: $load\n\n\.\n | mail fberbert\@gmail.com");
		exit;
	#} else {
		#print "load baixo: $load\n";
	}
	sleep($checkTimer);
}
