Website monitor using the Heroku free tier.
Design goals:
- As simple as possible
- Online but no running costs
- Configurable thresholds and selectors
- Different nofications, currently implemented are via E-mail and Pushbullet
- Get a Heroku Account and add a credit card so that you get 1000h dyno hours for free. No worries, it will not be charged.
- Install Heroku CLI and
cd website_monitor - Create a Heroku instance
heroku create, note down the app name - Add dyno-metadata from Heroku Labs:
heroku labs:enable runtime-dyno-metadata -a <app name>. This provides theHEROKU_APP_NAMEenvironment variable, which we need to prevent the app from idling.
Create a .env file in the project root and add variables as needed
# how often the websites are checked, optional, default=300
POLLER_INTERVAL=300After you are done, these env vars must be mirrored into Heroku. You can do that manually using the Heroku dashboard or use python env_to_heroku.py.
Put this into the .env file:
MAIL_ON=True
MAIL_RECIPIENTS=<email1>,<email1>,etc
MAIL_FROM=<email>
MAIL_SMTP_USERNAME=<usr>
MAIL_SMTP_PASSWORD=<pwd>
MAIL_SMTP_SSL_HOST=<host>:<port, usually 465>- Create free account on Pushbullet
- Edit the
.envfile:
PUSHBULLET_ON=True
PUSHBULLET_API_KEY=<generated access token>Add some websites to websites.yaml. See file for example.
git push heroku master
- Install the Python dependencies:
pip install -r requirements.txt
Now you got multiple options:
- Just start the webserver:
python app.py - Start Heroku:
heroku local web -f Procfile