AlertManager to Gotify bridge
Find a file
2021-05-27 07:38:16 +01:00
.github/workflows Remove testing on Python v3.5 as f-strings are used 2021-05-27 07:38:16 +01:00
src Move to requests to handle TLS connections 2021-05-27 07:38:16 +01:00
.dockerignore Initial commit 2020-10-13 09:19:35 +01:00
.gitignore Simple cosmetic change 2021-05-27 07:38:16 +01:00
alertify.py Add type hints 2021-05-27 07:38:16 +01:00
Dockerfile Perform a small refactor 2020-10-25 09:17:40 +00:00
example.yaml Move to requests to handle TLS connections 2021-05-27 07:38:16 +01:00
README.md Move to requests to handle TLS connections 2021-05-27 07:38:16 +01:00
requirements.txt Move to requests to handle TLS connections 2021-05-27 07:38:16 +01:00
test.sh Add the ability to delete original alert when matching resolved message arrives 2020-10-23 14:50:03 +01:00

This application bridges Prometheus Alertmanager alerts to Gotify.

Usage

usage: alertify.py [-h] [-c CONFIG] [-H]

Bridge between Prometheus Alertmanager and Gotify

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        path to config YAML. (default: alertify.yaml)
  -H, --healthcheck     simply exit with 0 for healthy or 1 when unhealthy

The following environment variables will override any config or default:
  * DELETE_ONRESOLVE  (default: False)
  * DISABLE_RESOLVED  (default: False)
  * GOTIFY_KEY_APP    (default: None)
  * GOTIFY_KEY_CLIENT (default: None)
  * GOTIFY_URL_PREFIX (default: http://localhost)
  * LISTEN_PORT       (default: 8080)
  * VERBOSE           (default: 0)

Notes

  • Requires Python v3.6 or greater (f-strings are used)
  • Listens on port 8080 by default.
  • Forwards resolved alerts, if not disabled.
  • Resolved alerts delete the original alert, if enabled.
  • Requires a Gotify app key to send alerts to Gotify
  • Requires a Gotify client key to delete original alert on resolution
  • Defaults, if not sent:
    Field Default value
    Priority 5
    Severity Warning

Docker

Build

docker build . -t 'alertify:latest'

Run

e.g.

docker run --name alertify -p 8080:8080 -e TZ=Europe/London -e GOTIFY_KEY_APP=_APPKEY_ -e GOTIFY_URL_PREFIX=http://gotify alertify:latest

Compose:

---
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
    ports:
      - "8080:8080"
    environment:
      - TZ=Europe/London
      - DELETE_ONRESOLVE=true
      - GOTIFY_KEY_APP=_APPKEY_
      - GOTIFY_KEY_CLIENT=_CLIENTKEY_
      - GOTIFY_URL_PREFIX=http://gotify
    restart: unless-stopped