OK, I'll post it here, and maybe in the code repository, if I can get it to work.
Here's my super simple little admin script that's super easy to configure for each new machine you need it to check. I'm sure someone could abstract it to run off a text file or database or something.
#!/usr/local/bin/php -q
<?
$ADMIN="you@email.address";
$PIN="somenumber";
$ADMIN_EMAIL="8007208398.$PIN@pagenet.net"; # This is for pagenet nationwide
$TMP="/tmp/wget.test";
$PATH="127.0.0.1/";
$tmp=split("/",$PATH);
$SERVER=$tmp[0];
$FILE=$tmp[1];
$USER="";
$PASS="";
if ($USER||PASS) $URL = "http://$USER:$PASS@$PATH";
else $URL = "http://$PATH";
$return=system("wget -q -s -t 2 -T 60 -O $TMP $URL");
$fp=fopen($TMP,"r");
$body=fread($fp,filesize($TMP));
fclose ($fp);
unlink ($TMP);
$test=split(" ",$body);
if ($test[1] == "200"){
Uncomment for a positive report message in cron mail
print "Hostname $SERVER is working working!\n";
}else{
$TMP="/tmp/sm.test";
$fp=fopen($TMP,"w");
$SENDMAIL = "From: $ADMIN\n";
$SENDMAIL.= "To: $ADMIN_EMAIL\n";
$SENDMAIL.= "Subject: Server down\n\n";
$SENDMAIL.= "The webserver known as $SERVER has stopped responding to http ";
$SENDMAIL.= "get requests for file $FILE\n\n";
$SENDMAIL.=".";
fwrite($fp,$SENDMAIL);
fclose ($fp);
Uncomment for a negative entry in your cron job mail
print $SENDMAIL;
system ("/usr/lib/sendmail -oi -t -odq <$TMP");
unlink ($TMP);
}
?>
Note that due to some strange issues at work the default sendmail mail() interface doesn't work right, so I've used sendmail. replacing this with send() is mostly chainsaw work.