Set alert rules and Telegram notifications to Grafana (v1.0)
Tested on Ubutnu 20.04, Grafana 7.4.3, Pormetheus 2.15.2

Prerequisites
  • Grafana installed and running
  • Prometheus installed and running
  • Telegram account

Set Telegram notifications

  1. First of all, you must create a new Telegram bot with BotFather. Click on this link https://t.me/botfather
    Insert command line /newbot

    Choose a full name for your bot.

    Choose a user name for your bot, the name must end with _bot

    Copy your BOT API Token.


  2. Create a new Telegram group. This group will receive notifications.

    Add your new bot to the group.


  3. Add your BOT API Token to this link https://api.telegram.org/bot< YOUR BOT API TOKEN >/getUpdates
    Get your Telegram group ID.


  4. On your Grafana instance, create a new notification channel.

    Click on New channel


  5. Add a channel name, choose type Telegram and add your BOT API Token and your Group ID.
    Before saving, test your new channel.


  6. Check notification test on Telegram group.


  7. You can now add an Alert rule to a panel.
    Alert rules are not available for all types of panels, panel with query like node_load can.


  8. Set condition to 90% and add your Telegram notification channel. On this panel, notifications will be sent every time CPU load goes above 90%.

    Click on Save button.

  9. When you see a green heart, that means your alert rule conditions are met. If not, you will receive Telegram and Email notification and you will see a broken red heart.


  10. You can add the plugin Grafana-image-render if you want to see a nice graph in notifications.
    sudo grafana-cli plugins install grafana-image-renderer

    If you want to know more about alert rules, you can browse the official Grafana documentation.


@ Level Up! 2022