Skip to content

Very simple tool to monitor HTTP and HTTPS URL, checking for valid HTTP status returned.

Notifications You must be signed in to change notification settings

sylvainb/supervision.website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

supervision.website

Goals :

  • Monitor HTTP and HTTPS URL, checking for valid HTTP status returned.
  • Compute state for each URL : OK (up), SLOW (slow response), KO (down).
  • Send email (text and HTML report) on state change (OK/SLOW -> KO, KO -> OK/SLOW) or if the website remains slow.
  • Use simple text files for data storage, no database necessary.

Configuration available :

  • URL list to monitor.
  • Request timeout.
  • Slow latency threshold.
  • Valid HTTP status list (global and per URL).
  • SMTP settings (subject, from, to, server).
  • Terms of sending emails : never, always, only on state change.
  • bash
  • wget
  • a working SMTP server

Download supervision.website and use virtualenv to test the module :

sudo apt-get install python-virtualenv
cd supervision.website
chmod +x install.sh
./install.sh

source bin/activate
(supervision.website) python
>>> import supervision.website

Create an edit the configuration file :

(supervision.website) cd src/supervision/website/
(supervision.website) cp config.py.sample config.py
(supervision.website) vi config.py

Create a file <where-you-want>/supervision_website_cron.sh with the following content (don't forget to adapt <egg-directory>). With this script, you can edit your configuration in config.py at any time, the check_hosts.sh script will be generated at each cron call.

#!/bin/bash
cd <egg-directory>
source bin/activate
cd src/supervision/website/utils
python generate_check_host_sh_script.py
chmod +x check_hosts.sh
./check_hosts.sh
python generate_reports.py

Change permissions settings for the cron bash script :

chmod +x <where-you-want>/supervision_website_cron.sh

Edit your personal crontab :

crontab -e

And and adapt the following lines :

# Launch supervision.website script every 10 minutes
*/10 * * * * <where-you-want>/supervision_website_cron.sh >> /tmp/supervision.website.cron.log

Launch tests with nose <https://nose.readthedocs.org/en/latest/>`_ :

(supervision.website) nosetests

Launch code coverage:

(supervision.website) nosetests --with-coverage --cover-inclusive --cover-html --cover-html-dir htmlcov
And open with a browser htmlcov/index.html

Source code is hosted on Github.

Source code and an issue tracker is hosted on Github.

About

Very simple tool to monitor HTTP and HTTPS URL, checking for valid HTTP status returned.

Resources

Stars

Watchers

Forks

Packages

No packages published