|
PHP host monitor script for use with crontab sends you e-mail |
|
|
|
Sunday, 30 September 2007 |
<?php
//Mofify here
$hosts[] = 'gmail.com';
$hosts[] = 'google.com';
$hosts[] = 'yahoo.com';
$mail = 'YourEmailAddressHere';
//don't tuch after this line if you don't know what you're doing
foreach ($hosts as $host) {
$out = exec("ping -c 3 $host");
if (strpos($out,'min/avg/max/mdev') == false) {
echo "$host - FAILED\r\nSending email $mail\r\n";
mail($mail,"$host - FAILED on " . date("Y-m-d H:i:s"),"HOST $host FAILED!");
} else {
echo "$host - SUCCESS\r\n";
}
}
?>
|
|
Last Updated ( Sunday, 30 September 2007 )
|