Grafana Alerting with Telegram Webhook
Overview
Grafana is great but unless you are going to stare at monitoring panels all day and night then you might want to get some alerts. I’ve found a nice way (and free way) to setup effectively a webhook to Telegram.
Setup Telegram and Grafana Alerts
-
In Telegram search for Botfather
-
Issue the “/newbot” command
-
Enter a name for the bot
-
Enter a username for the bot
The bot will issue a API token
Add that API token to the “BOT API Token” part of Grafana alerts
- Open a new message to the bot and type “/start”
- Issue the following curl statement in any web browser
Replace "\<TOKEN>" with the API token
https://api.telegram.org/bot/getUpdates
Example return
{"ok":true,"result":[{"update_id":123456789,
"message":{"message_id":1,"from":{"id":1234567890,"is_bot":false,"first_name":"FIRSTNAME","last_name":"LASTNAME","language_code":"en"},
"chat":{"id":1234567890,"first_name":"FIRSTNAME","last_name":"LASTNAME","type":"private"},"date":1591782293,"text":"/start","entities":[{"offset":0,
"length":6,"type":"bot_command"}]}}]}
- Save and test