https://github.com/georgesalkhouri/down-alert
Small Docker application. Tests if a service URL is reachable and sends a TLS encrypted mail if the service does not respond. Uses ping or wget for testing.
https://github.com/georgesalkhouri/down-alert
alerting docker monitoring ping python tls wget
Last synced: about 2 months ago
JSON representation
Small Docker application. Tests if a service URL is reachable and sends a TLS encrypted mail if the service does not respond. Uses ping or wget for testing.
- Host: GitHub
- URL: https://github.com/georgesalkhouri/down-alert
- Owner: GeorgesAlkhouri
- License: gpl-3.0
- Created: 2022-03-11T11:24:57.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-29T15:59:52.000Z (about 4 years ago)
- Last Synced: 2025-03-11T08:37:42.675Z (over 1 year ago)
- Topics: alerting, docker, monitoring, ping, python, tls, wget
- Language: Python
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Down Alert
Small Docker application. Tests if a service URL is reachable and sends a TLS encrypted mail if the service does not respond.
Uses ping or wget for testing.
## Usage
Clone the repository to your machine and copy the docker-compose.yml.example file.
```bash
git clone git@github.com:GeorgesAlkhouri/down-alert.git
cd down-alert
cp docker-compose.yml.example docker-compose.yml
# adjust docker-compose.yml file to your needs
# and deploy the service in the background with Docker.
docker compose up -d
```
## Config
Configure the app by setting the following env variables with docker compose.
```
# check every 5 minutes
DOWN_ALERT_INTERVAL: 300
# wait 3 hours
# after an alert could be sent successfully
DOWN_ALERT_INTERVAL_WAIT_AFTER_SEND: 10800
# use wget instead of ping to test reachability
DOWN_ALERT_USE_WGET: "True"
DOWN_ALERT_SMTP_SERVER: smtp.gmail.com
DOWN_ALERT_SMTP_PORT: 587
# Sender mail
DOWN_ALERT_FROM_MAIL: ...
# Receiver mail
DOWN_ALERT_TO_MAIL: ...
DOWN_ALERT_USER: ...
DOWN_ALERT_PASSWORD: ...
```
## Docker Compose Example
```yaml
x-down-alert-common:
&down-alert-common
image: python:3.10-alpine
environment:
&down-alert-common-env
TZ: Europe/Berlin
# check every 5 minutes
DOWN_ALERT_INTERVAL: 300
# wait 3 hours
# after an alert could be sent successfully
DOWN_ALERT_INTERVAL_WAIT_AFTER_SEND: 10800
# use wget instead of ping to test reachability
DOWN_ALERT_USE_WGET: "True"
DOWN_ALERT_SMTP_SERVER: smtp.gmail.com
DOWN_ALERT_SMTP_PORT: 587
# Sender mail
DOWN_ALERT_FROM_MAIL: ...
# Receiver mail
DOWN_ALERT_TO_MAIL: ...
DOWN_ALERT_USER: ...
DOWN_ALERT_PASSWORD: ...
volumes:
- ./src/:/app/:ro
command: ["python", "/app/__main__.py"]
healthcheck:
test: ["CMD", "pgrep", "-x", "python"]
interval: 30s
retries: 0
services:
sample-1-service:
<<: *down-alert-common
environment:
<<: *down-alert-common-env
DOWN_ALERT_USE_WGET: "False"
DOWN_ALERT_LOG_LEVEL: DEBUG
DOWN_ALERT_SERVER_URL: sample-1.service.de
sample-2-service:
<<: *down-alert-common
environment:
<<: *down-alert-common-env
TZ: Europe/London
DOWN_ALERT_INTERVAL: 3600
DOWN_ALERT_SERVER_URL: sample-2.service.com
```