I woke up this morning to a screen full of IM's from a customer saying their site had went down over night. He suggested that within 5 minutes of my being awake the site would be down again. We do offering monitoring services to our clients, but I realy didn't have time to get him setup with a full-scale solution, so I baked up something really quick that I could run in a window in the upper right corner of my screen to tell me if things went south on his site:
$ while [ true ]; do
perl -MLWP::Simple -e '
if(get("http://www.domain.com/")) {
print STDOUT localtime() . " website is up\n"; }
else { print STDERR localtime() . "WEBSITE IS DOWN!\n"; }';
sleep 5; done
It doesn't do much except hit the site and tell me if it's up or down. It's kind enough to give me the local time also for simple logging purposes. I run this in a screen session and it can go all day. I can scroll back through it to see if there was actually an outage and I can use the time to reference local logs on the server itself.
