Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon How do I configure Zabbix to use an HTTP proxy for Telegram notifications


How do I configure Zabbix to use an HTTP proxy for Telegram notifications


To configure Zabbix to use an HTTP proxy for Telegram notifications, follow these steps:

Step 1: Register a Telegram Bot

1. Open Telegram and send the command `/newbot` to `@BotFather`.
2. Follow the instructions provided to create your bot and obtain the bot token.

Step 2: Obtain Chat or Group ID

- For personal notifications, send `/getid` to `@myidbot` to get your user chat ID.
- For group notifications, add both `@myidbot` and your bot to the group. Then, send `/getgroupid@myidbot` in the group chat to obtain the group ID.

Step 3: Configure Zabbix Media Type

1. In Zabbix, navigate to Administration > Media types.
2. Create a new media type for Telegram or import an existing configuration. If you're using Zabbix 5.0 or later, you can use the following parameters:

- Name: Telegram
- Type: WEBHOOK
- Parameters:
- `Token`: Your bot token
- `To`: The chat ID or group ID
- `Message`: `{ALERT.MESSAGE}`
- `ParseMode`: (optional, e.g., Markdown)
- `HTTPProxy`: (set this to your proxy address, e.g., `https://proxy_address:port`)

Step 4: Set Up the Proxy in the Script

If you are using a script to send the notifications, ensure that it includes the proxy configuration. For example, in the script, you can set the proxy like this:

javascript
if (params.HTTPProxy) {
    Telegram.proxy = params.HTTPProxy;
    Zabbix.Log(4, '[Telegram Webhook] Use proxy: ' + params.HTTPProxy);
}

This will allow the script to send notifications through the specified HTTP proxy[1][3].

Step 5: Test the Configuration

- Create a test alert in Zabbix to ensure that notifications are sent correctly through the Telegram bot using the configured HTTP proxy.

By following these steps, you should be able to successfully configure Zabbix to send Telegram notifications via an HTTP proxy.

Citations:
[1] https://gist.github.com/CHERTS/04a0905d53c136ee8d5a81c4af93bc9d
[2] https://www.zabbix.com/integrations/telegram
[3] https://github.com/CHERTS/zabbix_telegram_webhook/blob/master/HOW-TO-USE-HTTPPROXY.md
[4] https://www.zabbix.com/forum/zabbix-help/461498-how-to-configure-sending-alerts-to-telegram
[5] https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/466963-sending-a-notification-to-a-topic-in-a-telegram-group
[6] https://dev.to/kurtchan/writing-a-telegram-and-email-notifications-script-for-zabbix-5ddj
[7] https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/431333-zabbix-front-end-access-internet-via-http-proxy
[8] https://www.zabbix.com/forum/zabbix-help/481247-delayed-zabbix-telegram-notification