A simple website monitor in python

English: Python powered logo with print("...
English: Python powered logo with print("Hello, world!)" type. (Photo credit: Wikipedia)
In my day job I monitor many many websites. Some very smart people within the company I work for have build a pretty advanced monitoring system for our websites, that together with the appropriate plug-in on the website allow for very detailed website status information. Without this tool my job would be out of control.

I guess every website owner has a need for monitoring website statuses. It does not matter if you run websites yourself or if you subscribed to a SaaS solution. I my self have some self hosted websites that I like to keep track of. So some time ago I wrote a little bash script that does exactly this. Bash works great for one or more sites, that need reporting to one group of people / email addresses. However if you want a different set of sites to have their status reported to a different group of people, then with the bash script I wrote you would need to run different instances of the script. Doable, but kinda unpractical. So I decided to take the same concept an write a more flexible solution in python.

The code, just one python file, is on Github.
https://github.com/davetromp/SiteMonitor
Mac and most linux distros all have python (2.7) installed by default. For these platforms you only need the .py file and the three config files: email.txt, sites.txt and config.txt. For all of you who are running windows and do not have python installed, I have created an executable using cx_freeze. Just download the zipfile, unzip it, configure and click SiteMonitor.exe.

Below is the code from the SiteMonitor.py file. Check out the GitHub repo for the complete project.