Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon How do I configure Zabbix to send different types of alerts to Telegram


How do I configure Zabbix to send different types of alerts to Telegram


To configure Zabbix to send different types of alerts to Telegram, follow these steps:

1. Create a Telegram Bot

- Use @BotFather on Telegram to create a new bot by sending the command `/newbot`.
- After creating the bot, you will receive a token that is necessary for API access.

2. Obtain Chat IDs

- Personal Notifications: Use @myidbot to get your personal chat ID. Start a chat with it and send `/getid`.
- Group Notifications: Add your bot to the group and send `/getgroupid@myidbot` in the group chat to get the group ID. Make sure to also send `/start@your_bot_name` to activate the bot in the group[2][3].

3. Configure Zabbix Media Type

- In the Zabbix web interface, navigate to Administration > Media types and create a new media type:
- Name: `telegram_notification.py`
- Type: `Script`
- Script name: `telegram_notification.py`
- Set the parameters to include:
- `{ALERT.SENDTO}` for the chat ID
- `{ALERT.SUBJECT}` for the subject of the message
- `{ALERT.MESSAGE}` for the alert content[1][2].

4. Set Up Alert Actions

- Go to Configuration > Actions and create a new action:
- Name: `Telegram notification`
- Subject: Customize it, e.g., `#{HOSTNAME}: {TRIGGER.NAME} {TRIGGER.STATUS}`
- Message: Customize the message format, for example:


    Value: {ITEM.VALUE} {TRIGGER.STATUS}
    Date: {EVENT.DATE} Time: {EVENT.TIME}
    

- You can use HTML tags for formatting, such as ``, ``, and `` for links[1][2].

5. Define Conditions and Operations

- In the Conditions tab, specify when the action should trigger based on your needs.
- In the Operations tab, define who will receive the alerts by adding the users or groups that should be notified. You can specify different operations for recovery notifications as well[1][2].

6. Assign Users

- Go to Administration > Users and select the users who will receive notifications.
- In the Media section for each user, add the Telegram media type and enter the appropriate chat ID or group ID[1][3].

7. Test the Configuration

- After completing the setup, test the configuration by simulating alerts in Zabbix to ensure that notifications are sent correctly to both personal and group chats.

By following these steps, you can effectively configure Zabbix to send various types of alerts to Telegram, leveraging both personal and group messaging capabilities.

Citations:
[1] https://github.com/GabrielRF/Zabbix-Telegram-Notification
[2] https://azdigi.com/blog/en/linux-server-en/tools-en/how-to-set-up-zabbix-alerts-via-telegram/
[3] https://www.kaznu.kz/content/files/news/folder23177/Lab%2013%20PCM.pdf
[4] https://github.com/ableev/Zabbix-in-Telegram
[5] https://www.zabbix.com/integrations/telegram
[6] https://ashoktutorials.blogspot.com/2017/06/zabbix-alert-notification-with-telegram.html
[7] https://thepalmtree.network/en/zabbix-telegram-notifications/
[8] https://stackoverflow.com/questions/73179062/perevent-sendind-certain-trigger-to-telegram


Small Logo CodingMall.com

CodingMall.com provides extensions for the Joomla! but is not affiliated with or endorsed by the Joomla! Project or its creator Open Source Matters.
All brand names used on this website are property of their respective registered owners and used for informational purposes only.