Skip to content

Instantly share code, notes, and snippets.

@logiclove
Forked from ilap/grafana_telegram_bot.md
Created July 24, 2020 14:57
Show Gist options
  • Select an option

  • Save logiclove/c51e725553f7bf7e86f77f287a2d1184 to your computer and use it in GitHub Desktop.

Select an option

Save logiclove/c51e725553f7bf7e86f77f287a2d1184 to your computer and use it in GitHub Desktop.

Revisions

  1. @ilap ilap revised this gist Dec 20, 2019. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions grafana_telegram_bot.md
    Original file line number Diff line number Diff line change
    @@ -56,7 +56,11 @@ https://api.telegram.org/bot<YOUR API TOKE FROM ABOVE>/getUpdates
    # Add alert

    - Go to dashboard
    - Select Jormungandr
    - Select Block Height Chart
    - Edit and add Alert.
    - Select "Jormungandr Monitor"
    - Select "Jormungandr Last Block Height", ckicj edit
    - Click Alarm icon
    - Click "Create Alert"
    - Edit the fields, see details below:
    ![Screen Shot 2019-12-20 at 8 14 31 pm](https://user-images.githubusercontent.com/1113398/71247974-bc5f4d80-2311-11ea-962b-6cc5f2e6989d.png)


  2. @ilap ilap revised this gist Dec 17, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion grafana_telegram_bot.md
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ BotFather
    Done! Congratulations on your new bot. You will find it at t.me/shelley_monitor_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.
    Use this token to access the HTTP API:
    __99...:AA......TvF8__
    99...:AA......TvF8
    Keep your token secure and store it safely, it can be used by anyone to control your bot.
    For a description of the Bot API, see this page: https://core.telegram.org/bots/api
    @@ -32,6 +32,7 @@ For a description of the Bot API, see this page: https://core.telegram.org/bots/
    # 2. Create a Channel and retrieve the channel's chat ID.

    - Create a channel in telegram and name it whatever you like. e.g. MyCardanoMonitoring or similar
    - Invite @BotFather to that channel as admin
    - Type at least one message, __this is very important__
    - Get the Chat id:
    ```
  3. @ilap ilap revised this gist Dec 17, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion grafana_telegram_bot.md
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@ For a description of the Bot API, see this page: https://core.telegram.org/bots/
    - Create a channel in telegram and name it whatever you like. e.g. MyCardanoMonitoring or similar
    - Type at least one message, __this is very important__
    - Get the Chat id:
    - ```
    ```
    https://api.telegram.org/bot<YOUR API TOKE FROM ABOVE>/getUpdates
    {"ok":true,"result":[{"update_id":1112223334445,
    "channel_post":{"message_id":1,"chat":{"id":-<YOUR_CHAT_ID>,"title":"ShelleyMonitoring","type":"channel"},"date":1576534122,"text":"/bot","entities":[{"offset":0,"length":4,"type":"bot_command"}]}}]}
  4. @ilap ilap revised this gist Dec 17, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion grafana_telegram_bot.md
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,8 @@

    # 1. Create bot

    ```
    Open Telegram and search for @BotFather user and message them the following:
    ```
    You
    /newbot
  5. @ilap ilap created this gist Dec 17, 2019.
    61 changes: 61 additions & 0 deletions grafana_telegram_bot.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,61 @@
    # Config Telegrambot for grafana's alerts.

    # 1. Create bot

    ```
    Open Telegram and search for @BotFather user and message them the following:
    You
    /newbot
    BotFather
    Alright, a new bot. How are we going to call it? Please choose a name for your bot.
    You
    TypeYourBotName
    BotFather
    Good. Now let's choose a username for your bot. It must end in `bot`. Like this, for example: TetrisBot or tetris_bot.
    You
    TypeYourBotNameBot
    BotFather
    Done! Congratulations on your new bot. You will find it at t.me/shelley_monitor_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.
    Use this token to access the HTTP API:
    __99...:AA......TvF8__
    Keep your token secure and store it safely, it can be used by anyone to control your bot.
    For a description of the Bot API, see this page: https://core.telegram.org/bots/api
    ```

    # 2. Create a Channel and retrieve the channel's chat ID.

    - Create a channel in telegram and name it whatever you like. e.g. MyCardanoMonitoring or similar
    - Type at least one message, __this is very important__
    - Get the Chat id:
    - ```
    https://api.telegram.org/bot<YOUR API TOKE FROM ABOVE>/getUpdates
    {"ok":true,"result":[{"update_id":1112223334445,
    "channel_post":{"message_id":1,"chat":{"id":-<YOUR_CHAT_ID>,"title":"ShelleyMonitoring","type":"channel"},"date":1576534122,"text":"/bot","entities":[{"offset":0,"length":4,"type":"bot_command"}]}}]}
    ```

    # Config Telegram in Grafana

    - Login to grafana
    - Click to the left Bell icon
    - Add notification channel
    - Select Telegram
    - Enable/disable settings you preger
    - Put Telegram API token to he fiel
    - Add chat ID (it starts with -, and that needs too)
    - Click Test notification
    - Save it.

    # Add alert

    - Go to dashboard
    - Select Jormungandr
    - Select Block Height Chart
    - Edit and add Alert.