Fork of nopp/alertmanager-webhook-telegram
1.4K
This is a Flask (Python) implementation.
helm template . -f values.yaml | kubectl apply -n monitoring -f -If you know how to use Helm's --set arguments, you may use that instead of editing values.yaml: helm template . -f values.yaml --set config.telegram.bot_token="XXXXX:YYYYYYYY",config.telegram.chat_id=\"-1234567\",config.basic_auth.enabled=false | kubectl apply -n monitoring -f -
Wasn't tested yet.
All the configuration is done using environment variables. Basic Authentication is disabled by default, the default loglevel is INFO. There are only two required environment variables: BOT_TOKEN and CHAT_ID.
Here's an example with every environment variable possible:
docker run -d --name alertmanager-webhook-telegram \
-e "BOT_TOKEN=XXXXX:YYYYYYYY" \
-e "CHAT_ID=-1234567" \
-e "FORCE_BASIC_AUTH=True" \
-e "LOG_LEVEL=INFO" \
-e "BASIC_AUTH_USERNAME=<username>" \
-e "BASIC_AUTH_PASSWORD=<password>" \
-p 8080:8080 justabaka/alertmanager-webhook-telegram:latest
docker build -t alertmanager-webhook-telegram .pip install -r requirements.txtpython flaskalert.pyKubernetes/Helm installation: edit template in the 'template_files' section of values.yaml and re-deploy the application.
Instead of editing the values.yaml you can simply supply a file to override or add contents during the render phase: helm template . -f values.yaml --set-file template_files.alert\\.j2=custom_template.j2 . Note the dot escaping.
Docker installation: copy the same file from the git repository and mount it back to /alertmanager-webhook-telegram/templates (it's usually better to mount a directory).
Manual installation: simply edit templates/alert.j2 Jinja2 template.
receivers:
- name: 'telegram-webhook'
webhook_configs:
- url: http://hostname:8080
send_resolved: true
http_config:
basic_auth:
username: 'username'
password: 'password'
It is possible to route alerts to different chats and users, not only a single predefined one. This can be easily done using query string arguments (e.g. 'http://hostname:8080/?chat_id=-1234567').
Please also check the telegram configuration section on how to send messages to individual users.
@BotFather./start then type or select /newbotIn order to send alerts an individual user you must obtain the Telegram user ID via https://t.me/userinfobot or a similar service. You may supply the ID as a regular chat id. Sending directly to @username is not supported yet.
Please also note that the user needs to send any message to the bot first.
You can use bash snippets inside the tests directory.
Content type
Image
Digest
Size
19.7 MB
Last updated
almost 6 years ago
docker pull justabaka/alertmanager-webhook-telegram