alertmanager icon indicating copy to clipboard operation
alertmanager copied to clipboard

Wants alerting to subgroups in telegram

Open P9os opened this issue 1 year ago • 6 comments

In one of updates of Telegram messanger added subgroups to group chats. Please add possibility send messages to subgroups. For will made this need add one field message_thread_id in request for Telegram Bot API. Thanks

P9os avatar Apr 21 '23 05:04 P9os

Just add message_thread_id field to <telegram_config> (https://prometheus.io/docs/alerting/latest/configuration/#telegram_config)

udartsev avatar Oct 31 '23 13:10 udartsev

Just add message_thread_id field to <telegram_config> (https://prometheus.io/docs/alerting/latest/configuration/#telegram_config)

why should it work if its undocumented? It doesnt seem like a field that would automatically work? :{

dennislapchenko avatar Nov 03 '23 19:11 dennislapchenko

@udartsev it does not work as you suggested.

alertmanager config:

  telegram_configs:
    - send_resolved: false
      chat_id: -1001868435535
      message_thread_id: 1486
image: prom/alertmanager:v0.26.0

Error log:

ts=2023-11-08T14:53:42.575Z caller=coordinator.go:118 level=error component=configuration msg="Loading configuration file failed" file=/etc/alertmanager/alertmanager.yml err="yaml: unmarshal errors:\n  line 39: field message_thread_id not found in type config.plain"

not surprising, since it's not documented.

dennislapchenko avatar Nov 08 '23 14:11 dennislapchenko

Upvote for this feature, but currently theres no per-topic policies in telegram, such as 'send message' to prevent user messaging in topics planned for alerts. w8ing for yr experience, but seems writing yet another bot paired with alertmanager webhooks is unavoidable to achieve functionality i ve mentioned

we1rdw4y avatar Feb 11 '24 02:02 we1rdw4y

Alertmanager may have already implemented this, I'll check it separately on the latest version. But I found an article (in Russian) in which a person modifies the internal code of Alertmanager to add support for message_thread_id to the function of sending messages to TG. https://nixhub.ru/posts/alertmanager-to-tg-topics/ I plan to try to make my own build with these changes in the container. PS. I find allready modifed alertmanager for supergroup tg - https://github.com/oktend/alertmanager

veselov-v avatar Aug 16 '24 17:08 veselov-v