Lesstion 4 - Zabbix 6.2 alerts via Telegram
04/03/2023 - 1 phút
Setting up Telegram
- Register a new Telegram Bot: Send “/NewBot” to @BotFather and follow the instructions. The token provided by @botfather in the final step will be necessary to configure the Zabbix Webhook.
- If you want to send personal notifications, you need to get the chat ID of the user that the bot should send messages to.
Ask the user to send “/start” to the bot, created in step 1. If you skip this step, the Telegram Bot will not be able to send messages to the user.
Setting up Zabbix
- In the “Administration > Media types” section, enter media_telegram.yaml.
- Configure the type of media to be added: Copy and paste your Telegram bot token into the “Telegramtoken” field.
In the Parsemode parameter option required by Telegram documentation. Read the Telegram BOT API documentation to learn how to format notifications: Markdown / HTML / MarkDownv2.
Note: In this case, your Telegram-related actions must be separated from other notification actions (e.g. SMS), otherwise you may receive a simple text notification with Raw Markdown/HTML tags.
After configuring, test the configuration by using the ID of the group or individual.
If you forget to send ‘/start’ to the bot from Telegram, you will encounter the following error:
- To receive notifications in Telegram, you need to create a Zabbix user and add media with the Telegram type. In the “Sent to” field, enter the Telegram user ID or group ID obtained during the Telegram setup process.
After the incident, the notification will be sent via Telegram.
You can refer to the details at: https://www.zabbix.com/integrations/telegram