$host = "ip_or_hostname_to_check_here"; $name_of_comp_to_notify = 'computer66'; print "Started ...\n"; &ping_check; sub ping_check { ¤t_date_time; use Net::Ping; $p = Net::Ping->new("icmp"); if ($p->ping($host, 2)) { &host_up; } else { &host_down; } $p->close(); } sub host_up { print "$date_time - Host $host is up\n"; system("net send $name_of_comp_to_notify $host is up"); } sub host_down { print "$date_time - Host $host is down\n"; sleep 30; &ping_check; } sub current_date_time { ($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $longyr = $year + 1900; $fixmo = $mon + 1; if ($mday < 10) { $mday = "0$mday" ; } if ($fixmo < 10) { $fixmo = "0$fixmo" ; } if ($hr < 10) { $hr = "0$hr" ; } if ($min < 10) { $min = "0$min" ; } if ($sec < 10) { $sec = "0$sec" ; } $date_time="$mday\/$fixmo\/$longyr $hr:$min:$sec"; }