Zabbix + Telegram

Содержание

Telegram is a cloud-based instant messaging and voice over IP service. Telegram client apps are available for Android, iOS, Windows Phone, Windows NT, macOS and GNU/Linux. Users can send messages and exchange photos, videos, stickers, audio and files of any type.

Available solutions

Also available for: 5.0

Telegram webhook

This guide describes how to send notifications from Zabbix 5.0 to the Telegram messenger using Telegram Bot API and Zabbix webhook feature.

Supported features:

  • Personal and group notifications
  • Markdown/HTML support

Not implemented:

  • Graphs sending — waiting for ZBXNEXT-5611
  • Emoji support

Telegram setup

1. Register a new Telegram Bot: send /newbot to @BotFather and follow the instructions. The token provided by @BotFather in the final step will be needed for configuring Zabbix webhook.

2. If you want to send personal notifications, you need to obtain chat ID of the user the bot should send messages to.

Send /getid to @myidbot in Telegram messenger.

Ask the user to send /start to the bot, created in step 1. If you skip this step, Telegram bot won’t be able to send messages to the user.

3.If you want to send group notifications, you need to obtain group ID of the group the bot should send messages to. To do so:

Add @myidbot and @your_bot_name_here to your group. Send /[email protected] message in the group. In the group chat send /[email protected]_bot_name_here. If you skip this step, Telegram bot won’t be able to send messages to the group.

Zabbix setup

1. In the Administration Media types section, import the media_telegram.yaml. 2. Configure the added media type: Copy and paste your Telegram bot token into the telegramToken field.

In the ParseMode parameter set required option according to the Telegram’s documentation. Read the Telegram Bot API documentation to learn how to format action notification messages: Markdown / HTML / MarkdownV2. Note: in this case, your Telegram-related actions should be separated from other notification actions (for example, SMS), otherwise you may get plain text alert with raw Markdown/HTML tags.

Test the media type using chat ID or group ID you’ve got.

If you have forgotten to send ‘/start’ to the bot from Telegram, you will get the following error:

3.To receive notifications in Telegram, you need to create a Zabbix user and add Media with the Telegram type. In the Send to field enter Telegram user chat ID or group ID obtained during Telegram setup.

Make sure the user has access to all hosts for which you would like to receive Telegram notifications.

Great, you can now start receivng Zabbix notifications in Telegram!

Also available for: 5.4

Telegram webhook

This guide describes how to send notifications from Zabbix 5.0 to the Telegram messenger using Telegram Bot API and Zabbix webhook feature.

Supported features:

  • Personal and group notifications
  • Markdown/HTML support

Not implemented:

  • Graphs sending — waiting for ZBXNEXT-5611
  • Emoji support

Telegram setup

1. Register a new Telegram Bot: send /newbot to @BotFather and follow the instructions. The token provided by @BotFather in the final step will be needed for configuring Zabbix webhook.

2. If you want to send personal notifications, you need to obtain chat ID of the user the bot should send messages to.

Send /getid to @myidbot in Telegram messenger.

Ask the user to send /start to the bot, created in step 1. If you skip this step, Telegram bot won’t be able to send messages to the user.

3.If you want to send group notifications, you need to obtain group ID of the group the bot should send messages to. To do so:

Add @myidbot and @your_bot_name_here to your group. Send /[email protected] message in the group. In the group chat send /[email protected]_bot_name_here. If you skip this step, Telegram bot won’t be able to send messages to the group.

Zabbix setup

1. In the Administration Media types section, import the media_telegram.xml. 2. Configure the added media type: Copy and paste your Telegram bot token into the telegramToken field.

In the ParseMode parameter set required option according to the Telegram’s documentation. Read the Telegram Bot API documentation to learn how to format action notification messages: Markdown / HTML / MarkdownV2. Note: in this case, your Telegram-related actions should be separated from other notification actions (for example, SMS), otherwise you may get plain text alert with raw Markdown/HTML tags.

Test the media type using chat ID or group ID you’ve got.

If you have forgotten to send ‘/start’ to the bot from Telegram, you will get the following error:

3.To receive notifications in Telegram, you need to create a Zabbix user and add Media with the Telegram type. In the Send to field enter Telegram user chat ID or group ID obtained during Telegram setup.

Make sure the user has access to all hosts for which you would like to receive Telegram notifications.


Источник: www.zabbix.com