Too cheap to get a proper monitoring tool? Here’s a simple Python script that I wrote that will send me an email if my webserver isn’t returning HTTP 200.
git clone https://github.com/pugnusferreus/py_monitoring.git
- Open monitoring.py with your favourite text editor.
- Change the
- On line 36 and 37, change your webserver address and the email subject and message.
- Copy monitoring.py to your webserver
- Add the script to your crontab by typing sudo crontab -e
- To run the script every 5 minutes, enter
*/5 * * * * /<your path>/monitor.py
Note: I’ve only tested this script on Python 2.6 (since my server came with that version of Python). I’m not sure if it’ll work on Python 3.