Document history
Date | Changes |
23. December 2020 | Published |
Important notes & disclaimer
This guide is provided without any warrenty/guarantee (“as is”). Feel free to let us know your feedback! We are happy to apply healthy critique to this guide!
Overview
We’ll go through following topics to get notifications on Telegram and/or Discord
- Create a Telegram Bot
- Create a Discord server & channel
- Add notification channels to the grafana
Create a Telegram-Bot
First we need to log in to Telegram. If you already have a telegram-account, go here and log in, if not then go here and follow the steps to create a new telegram-account. You can use a web browser or telegram app to log in. In this guide we’re going to utilize web browser
Once you have successful logged in to telegram, type in search box <BotFather> and click on it. <BotFather> telegram bot will assist you to creating your bot

Next click on <START> to begin to communicate with <BotFather>

Now it’s ready to create a new bot

Type /newbot
to create a new bot

Next <BotFather> will ask you to choose a name
for your new bot. In this case <stereum_test> is chosen as bot name

The <BotFather> will also ask you to choose a username
for your bot. The username
must in end `bot`
also must unique. In this guide <stereum_test_bot> is chosen as username
. After that you will get your BOT HTTP API token
and it will be used to control your telegram bot. Keep it safely!

In this case BOT HTTP API token: 1457063729:AAHvldeG-JdmdTlyzssY8owWPTlMOQzaf9I
and it will be used in the last step to set up notification channel on the grafana
Open your favorite web browser and visit https://api.telegram.org/bot<your-HTTP-API-token>/getUpdates
, instead <your-HTTP-API-token>
put your HTTP API token. At the moment there is nothing to show on the web browser, since a bot is just created. However leave it open to get Chat-ID
on that window in the next step. It should look something like this

Next we’re going to create a new group on the telegram which will be used to receive the alerts from Grafana. To do that click on top left corner and select <New group>

Type your bot’s username
(in this case stereum_test_bot
) and select your bot to add into the group, then click on <NEXT>

Next choose your group name (in this case <stereum_test_group>
) then click on <CREATE GROUP>

We’ve just created a new group on the telegram. Click on the top <your-group-name>
to get a list of your group members.

Here you can see that newly created bot is added to this group. Click on bot (in this case: stereum_test
)

To get bot’s Chat-ID
, bot have to be part of some activity. Here we’re going to use <Add to group> to add the bot into the group again

Next choose your group which is created previously

Go back to the web browser, which we’ve already opened previously and press <F5>
then you’ll get bot’s <Chat-ID>
as shown below

Latest activities will be written at the bottom of the page. Therefore you’ll find your bot’s <Chat-ID>
bottom-most, since bot is just invited to the group.
Bot <Chat-ID>
should begin with a minus <->
sign. In this case Chat-ID:-481124770
and it will be used in the last step to set up notification channel on the grafana
Completed! Congratulation! Now your telegram-bot is ready to be configured as notification channel on the grafana
Create Discord server & channel
First we need to log in to Discord. If you already have a discord-account, go here and log in, if not then go here and follow the steps to create a new Discord-account. You can use a web browser or discord app to log in. In this guide we’re going to utilize web browser
Once you have successful logged in to discord, click on <+>
sign on the left panel to add a new server on discord

Then select <Create My Own>
option as shown below

Next choose & type your server name. In this case <stereum-test-server>
is chosen as server name. Then click on <Create>

You’ll see the newly created server on the left panel and Welcome to <your-server-name> message!

Let’s create a new text channel on your discord server which will be used to receive alert notifications from grafana. To do that click on <+>
sign as shown below

Put your channel name in <CHANNEL NAME>
bar and click on <Create Channel>
. In this case <stereum-test-channel>
is chosen as a channel name

Once your server and text channel are successful created then right click on the server and select Server Settings -> Integrations
where we’re going to create discord Webhook.

Click on <Create Webhook>

On the next window
- choose a name for your webhook. In this case <stereum-test-webhook> is chosen as name
- select your previously created text channel in the dropdown menu. In this case
<stereum-test-channel>
is chosen as channel - click on
<Copy Webhook URL>
. This URL will be used in the next step to set up notification channel on the grafana

Done! Congratulation! Now your discord server and channel is ready to be configured as notification channel on the grafana.
Add notification channel to the Grafana
First we need to log in to Grafana. if you already familiar with grafana visit here, put your username and password to log in. If not visit here and put <admin>
as username as well as password, then you’ll be asked to provide new password for grafana. Give your password and you are in!
Once you have successful logged in to grafana, click on <Alerting>
(Bell icon on the left panel) and select <Notification channels>
as shown below

Then click on <Add channel>
to add new notification channel to the grafana
Telegram
The following steps needed to be configured on the grafana to get alert notifications on the telegram

- Choose a name for the notification channel. Here
<telegram-stereum>
is chosen as name of the notification channel - Choose
<Telegram>
in the dropdown menu - Provide your telegram BOT HTTP API token which is already created above
- Put your bot’s
<Chat-ID>
which is also created previously - Tick
<Default>
option to receive notifications from alerts which are configured on the grafana - Tick
<Include image>
option to get notifications with graphical illustration of your grafana panels. Grafana image renderer is required to get graphical sample and it’s already installed as well as set up on the ethereum2-docker-compose - Click on
<Test>
. All goes well, then you will get test message as shown below - Click on
<Save>
!

Congratulation! The Telegram notification channel is configured and saved on the grafana and you’ll get notifications from grafana on your telegram
Discord notifications
The following steps needed to be configured on the grafana to get alert notifications on the discord

- Choose a name for the notification channel. Here
<discord-stereum>
is chosen as name of the notification channel - Choose
<Discord>
in the dropdown menu - Provide your discord Webhook which is already created above
- Tick
<Default>
option to receive notifications from the alerts which are configured on the grafana - Tick
<Include image>
option to get notifications with graphical illustration of your grafana panels. Grafana image renderer is required to get graphical sample and it’s already installed as well as set up on the ethereum2-docker-compose - Click on
<Test>
. All goes well, then you will get test message as shown below - Click on
<Save>
!

Great, done! The Discord notification channel is configured and saved on the grafana and you’ll get notifications from grafana on your discord
Thanks for reading & Enjoy Notifications!