A simple stand-alone Web service for monitoring websites
The code is runnable as a stand-alone Web server.
- Python 2.7
- web.py python module
- python requests
- Get the code
- Install web.py
pip install web.py
- Install requests
pip install requests
Set the following variables in website-check.py
- poll_interval (how often each site should be checked)
- max_fails (maximum number of times a site can fail the check before email notification
- gmail_user = '' (your gmail email address)
- gmail_pwd = '' (your gmail password)
- recipients = ['[email protected]', '[email protected]'] (who email should be sent to)
You can also use a smtp server other than gmail. Just set the values appropriately and see Python's smtplib documentation for more details.
There are two options: either specify URLs and assertion strings at runtime (use "" for no assertion), or specify a text file that contains comma separated URLs and assertion strings.
python website-check.py port "site1" "assert1" ["site2" "assert2" ... ]
- `python website-check.py port servers.txt
Sample servers.txt
http://www.google.com,I'm feeling lucky http://www.yahoo.com,Yahoo http://www.bing.com,
Navigate to http://localhost:port to view...