emails you a report if a web page indicates that a service is down or has not been running
-
Supply a URL
-
Supply a function that, given a BeautifulSoup object as input, decides whether the service is down and outputs a useful message. There are some provided in
itsdown.functions
-- you supply a function on the command line as a dotted path. -
If the service is down, email someone with the message, with a link to the URL, and with the page output attached to the email.
git clone [email protected]:dwinston/itsdown.git
cd itsdown
pip install -e .
cp itsdown/config.example.ini itsdown/config.ini
# Edit itsdown/config.ini to reflect your email service SMTP information.
python itsdown/main.py \
--url "https://structpred.dash.materialsproject.org/report/hours/24/" \
--fn "itsdown.functions.fwsdash_24hr" \
--to [email protected]
In addition to the above, you can use Celery to run reports in a crontab-like manner.
You'll need to install RabbitMQ (Celery's recommended so-called "data broker"):
# Ubuntu/Debian?
sudo apt-get install rabbitmq-server
# Docker?
docker run -d -p 5462:5462 rabbitmq
# Homebrew?
brew install rabbitmq
Start the RabbitMQ server:
# For example, if you use `brew install` on a Mac, this will ensure rabbitmq starts now and on system restarts.
brew services start rabbitmq
Start the Celery server:
celery -A itsdown.tasks worker -l info
(Under construction) Use celery.schedules.crontab
to do great things!