2020-10-13 17:26:14 +01:00
|
|
|
This application bridges [Prometheus Alertmanager](https://prometheus.io/docs/alerting/latest/alertmanager/) alerts to [Gotify](https://gotify.net/).
|
|
|
|
|
|
|
|
# Usage
|
|
|
|
```
|
2020-10-19 18:44:02 +01:00
|
|
|
usage: alertify.py [-h] [-c CONFIG] [-H]
|
2020-10-13 17:26:14 +01:00
|
|
|
|
|
|
|
Bridge between Prometheus Alertmanager and Gotify
|
|
|
|
|
|
|
|
optional arguments:
|
2020-10-19 18:44:02 +01:00
|
|
|
-h, --help show this help message and exit
|
|
|
|
-c CONFIG, --config CONFIG
|
2020-10-23 12:39:10 +01:00
|
|
|
path to config YAML. (default: alertify.yaml)
|
2020-10-19 18:44:02 +01:00
|
|
|
-H, --healthcheck simply exit with 0 for healthy or 1 when unhealthy
|
2020-10-13 17:26:14 +01:00
|
|
|
|
2020-10-19 18:44:02 +01:00
|
|
|
The following environment variables will override any config or default:
|
2020-10-26 11:40:26 +00:00
|
|
|
* DELETE_ONRESOLVE (default: False)
|
|
|
|
* DISABLE_RESOLVED (default: False)
|
|
|
|
* GOTIFY_KEY_APP (default: None)
|
|
|
|
* GOTIFY_KEY_CLIENT (default: None)
|
|
|
|
* GOTIFY_PORT (default: 80)
|
|
|
|
* GOTIFY_SERVER (default: localhost)
|
|
|
|
* LISTEN_PORT (default: 8080)
|
|
|
|
* VERBOSE (default: 0)
|
2020-10-13 17:26:14 +01:00
|
|
|
```
|
|
|
|
|
2020-10-13 15:31:33 +01:00
|
|
|
|
|
|
|
# Notes
|
2020-10-28 17:46:03 +00:00
|
|
|
* Requires Python v3.6 or greater (f-strings are used)
|
2020-10-13 15:36:16 +01:00
|
|
|
* Listens on port 8080 by default.
|
2020-10-23 10:06:51 +01:00
|
|
|
* Forwards `resolved` alerts, if not disabled.
|
|
|
|
* Resolved alerts delete the original alert, if enabled.
|
2020-10-24 20:43:19 +01:00
|
|
|
* Requires a Gotify app key to send alerts to Gotify
|
|
|
|
* Requires a Gotify client key to delete original alert on resolution
|
2020-10-13 15:31:33 +01:00
|
|
|
* Defaults, if not sent:
|
|
|
|
| Field | Default value |
|
|
|
|
|-------------|---------------|
|
|
|
|
| Priority | `5` |
|
2020-10-23 10:06:51 +01:00
|
|
|
| Severity | `Warning` |
|
2020-10-13 15:31:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Docker
|
2020-10-13 15:44:31 +01:00
|
|
|
## Build
|
|
|
|
```bash
|
|
|
|
docker build . -t 'alertify:latest'
|
|
|
|
```
|
|
|
|
|
2020-10-13 15:31:33 +01:00
|
|
|
## Run
|
|
|
|
|
|
|
|
e.g.
|
|
|
|
```bash
|
2020-11-08 18:49:40 +00:00
|
|
|
docker run --name alertify -p 8080:8080 -e TZ=Europe/London -e GOTIFY_KEY_APP=_APPKEY_ -e GOTIFY_SERVER=gotify -e GOTIFY_PORT=80 alertify:latest
|
2020-10-13 15:31:33 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
## Compose:
|
|
|
|
```yaml
|
|
|
|
---
|
|
|
|
version: "2"
|
|
|
|
services:
|
|
|
|
gotify:
|
|
|
|
image: gotify/server:latest
|
|
|
|
container_name: gotify
|
|
|
|
environment:
|
|
|
|
- TZ=Europe/London
|
|
|
|
volumes:
|
|
|
|
- config/config.yml:/etc/gotify/config.yml
|
|
|
|
- data:/app/data
|
|
|
|
restart: unless-stopped
|
|
|
|
|
|
|
|
alertify:
|
|
|
|
image: alertify:latest
|
|
|
|
container_name: alertify
|
2020-10-13 15:36:16 +01:00
|
|
|
ports:
|
|
|
|
- "8080:8080"
|
2020-10-13 15:31:33 +01:00
|
|
|
environment:
|
|
|
|
- TZ=Europe/London
|
2020-10-24 20:43:19 +01:00
|
|
|
- DELETE_ONRESOLVE=true
|
2020-11-08 18:49:40 +00:00
|
|
|
- GOTIFY_KEY_APP=_APPKEY_
|
|
|
|
- GOTIFY_KEY_CLIENT=_CLIENTKEY_
|
2020-10-13 15:31:33 +01:00
|
|
|
- GOTIFY_SERVER=gotify
|
|
|
|
- GOTIFY_PORT=80
|
|
|
|
restart: unless-stopped
|
|
|
|
```
|