This repository is used to monitor the health of https://pdap.io/, send alerts when errors are detected, and, where necessary, perform corrective actions.
It is designed to function within the Automation Manager Digital Ocean Droplet. It's deployed to https://automation.pdap.io
The script will check the status of the search endpoint.
If the endpoint is not functioning as expected, it will send an alert to the PDAP Discord, within the private/#dev-alerts channel.
The script will log to a file named health_monitoring.log in the root directory. These logs are designed to rotate every day at midnight.
git clone https://github.com/Police-Data-Accessibility-Project/health-monitoring.git
cd health-monitoring
The app needs access to these variables. Reach out to contact@pdap.io or make noise in Discord if you'd like access.
WEBHOOK_URL=<YOUR_WEBHOOK_URL>
TEXTBELT_API_KEY=<YOUR_API_KEY>
SMS_NUMBER=<NOTIFICATION_RECIPIENT_PHONE>When deployed, these variables can be managed in the build environment: http://automation.pdap.io/job/Health-Monitor/configure
All verification will need to be performed within the Automation Manager Droplet, in the health-monitoring directory, accessible from the home directory. The Automation Manager can be accessed via SSHing into the Droplet.
Within the health-monitoring directory, run:
cat health_monitoring.logThis should show up in the terminal. The log should show results such as:
2024-06-15 17:00:06,452 - INFO - Search endpoint is functioning as expected.
2024-06-15 18:00:06,097 - INFO - Search endpoint is functioning as expected.
2024-06-15 19:00:05,291 - INFO - Search endpoint is functioning as expected.
The timestamps should always show activity within the last hour. In the case of errors, these should also be logged within this file.
From the scripts directory, within the appropriate environment, run:
python3 src/sms.pyThis will post the message "Testing from health-monitoring" to the Webhook URL in the .env file, which should show up in the private/#dev-alerts in the Discord.