

WEBSITE MONITOR DOWN CODE
Knowing I would be programming against the Pi hardware, I began looking around for Python code on GitHub to give me a head start on the monitoring. My Pi is running Raspbian, a trimmed version of Debian Linux optimized for the Raspberry Pi hardware. For example, even if your database server isn't WAN accessible, checking a web page that makes a connection to that database for a success phrase can tell you that the DB server is running fine.
WEBSITE MONITOR DOWN FULL
Although this is not full blown server monitoring, by choosing WAN accessible pages from each server to monitor, along with a response assertion, you can get a good amount of confidence and status reporting. My first task was to program the Pi to monitor the sites. Just add a USB WiFi dongle and some code to monitor the servers and you're good to go. With no fans and just a plain old micro-usb port for a power supply, the Pi has no moving parts and is totally silent - perfect for a bedroom. My idea was to use a Raspberry Pi B+ I've had sitting around to ping websites and web apps over WiFi and then alert me in some visual way that might wake me up (I'm a light sleeper). Then I could get up, however annoying that may be, and solve it before anyone ever notices. It would be preferable to have some type of indication in the night that there was a problem. The feeling of uncertainty that this causes has been a problem for me for years now and there is no worse way to start your day than by waking up to a pile of alert emails, angry customers, and down servers. Those do me no good since I leave my phone silent in my office at night and if I were to keep it in my bedroom with audible alerts for every email and SMS I get my wife would kill me.

We've got server monitoring tools configured and running, but when an outage is detected I get an email or SMS to notify me. That means that after you go to bed, if a server goes down, you won't know about it until morning. At a smaller company, you may still have these critical sites, applications, and servers, but no one on call or available in the middle of the night. Setting up robust server monitoring using a package like Nagios or Zabbix is extremely complicated and time consuming, in fact it's some people's entire job at larger companies. Providing hosting services and running your own servers means that you're constantly on guard for things going wrong and failing.
