This project is deprecated! Please look at alertmanager-notifier, which is a drop-in replacement. Hence, this project is archived.
A simple webserver in Flask, that translates alertmanager alerts into telegram messages.
docker run --rm -it \
-p 9999:9999 \
-e TELEGRAM_TOKEN="your token" \
-e TELEGRAM_CHAT_ID="your chat id" \
-e PORT=9999 \
-e GELF_HOST=graylog \
--name alertmanager-telegram-bot \
registry.gitlab.com/ix.ai/alertmanager-telegram-bot:v0.6.0
Alterantively, use the hub.docker.com image:
docker run --rm -it \
-p 9999:9999 \
-e TELEGRAM_TOKEN="your token" \
-e TELEGRAM_CHAT_ID="your chat id" \
-e PORT=9999 \
-e GELF_HOST=graylog \
--name alertmanager-telegram-bot \
ixdotai/alertmanager-telegram-bot:latest
Run the test agains the bot:
curl -X POST -d '{"alerts": [{"status":"Testing alertmanager-telegram-bot", "labels":[], "annotations":[], "generatorURL": "http://localhost"}]}' -H "Content-Type: application/json" localhost:9119/alert
route:
receiver: 'telegram alerts'
routes:
- receiver: 'telegram-webhook'
receivers:
- name: 'telegram-webhook'
webhook_configs:
- url: http://alertmanager-telegram-bot:9119/alert
Variable | Default | Mandatory | Description |
---|---|---|---|
TELEGRAM_TOKEN |
- | YES | see the Telegram documentation how to get a new token |
TELEGRAM_CHAT_ID |
- | YES | see this question on stackoverflow |
LOGLEVEL |
INFO |
NO | Logging Level |
GELF_HOST |
- | NO | if set, the exporter will also log to this GELF capable host on UDP |
GELF_PORT |
12201 |
NO | Ignored, if GELF_HOST is unset. The UDP port for GELF logging |
PORT |
9119 |
NO | The port for prometheus metrics |
ADDRESS |
* |
NO | The address for the bot to listen on |
TEMPLATE |
notify.html.j2 |
NO | The template file to be used when creating the telegram message |
alertmanager-telegram-bot supports jinja templating. take a look at templates/notify.html.j2 for that. If you want to use your own template, mount it as a volume in docker and set the TEMPLATE
environment variable. The mount path should be under /templates/
(for example /templates/my-amazing-template
).
Starting with version v0.6.1, the images are multi-arch, with builds for amd64, arm64, armv7 and armv6.
vN.N.N
- for example v0.6.0latest
- always pointing to the latest versiondev-branch
- the last build on a feature/development branchdev-master
- the last build on the master branch
- GitLab: https://gitlab.com/ix.ai/alertmanager-telegram-bot
- GitHub: https://github.com/ix-ai/alertmanager-telegram-bot
- Docker Hub: https://hub.docker.com/r/ixdotai/alertmanager-telegram-bot
This work is inspired by nopp/alertmanager-webhook-telegram