A simple website monitor in python
|English: Python powered logo with print("Hello, world!)" type. (Photo credit: Wikipedia)|
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.
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.