Fixing Telegram configuration with Alertmanager
As usual, a quick one for me to remember what I did to fix a misconfiguration on my side.
As I explained in a previous article, I'm using Prometheus as monitoring system.
I initially configured alerts to be sent by email, but I also wanted to have Telegram messages sent to a bot, so I can have more real-time alerts (instead of having to check my emails).
The Prometheus documentation has good details on that, but I struggled to find the correct configuration.
I tried this Alertmanager configuration:
receivers:
- name: 'Telegram'
telegram_configs:
- chat_id: '<CHAT_ID>'
bot_token: 'bot111111:HDKQEUBFIQEBUK123jn' # REDACTED
send_resolved: true
=> I had an issue with the chat_id
: it must not contain quote, just paste the
chat ID directly.
But still, even after fixing that, I did not get Telegram messages.
Turns out the bot_token
must just be the token without bot
, so that gives:
receivers:
- name: 'Telegram'
telegram_configs:
- chat_id: <CHAT_ID>
bot_token: '111111:HDKQEUBFIQEBUK123jn' # REDACTED
send_resolved: true
With that, I am now receiving messages over Telegram whenever an alert is triggered.
Tags: IT