#!/usr/bin/perl my $ip = "xxx.xxx.xxx.xxx"; # ip or hostname or machine to look for my $addy = "bob@foo.com"; # location notification goes my $subject = "Info"; #mail subject for notification my $drop_message = "Cable is down"; #message displayed when machine disappears my $recover_message = "Cable is Up Again"; #message displayed when machine reappears while(1) { $test = system("ping -c 2 $ip"); if ($test != 0) { #notify of site Drop system("echo $drop_message | mail -s $subject $addy"); #Test until address responds again while ($test != 0) { $test = system("ping -c 2 $ip"); if ($test == 0) { system("echo $recover_message | mail -s $subject $addy"); break; } } } sleep(60); # sleep so we only check once a minutre for the machine }