Skip to content
This repository has been archived by the owner on Aug 14, 2022. It is now read-only.

send 2 telegram group #61

Open
sandr30 opened this issue May 5, 2019 · 11 comments
Open

send 2 telegram group #61

sandr30 opened this issue May 5, 2019 · 11 comments

Comments

@sandr30
Copy link

sandr30 commented May 5, 2019

metalmatze alertmanager bot alert job1 send Telegram channel1 and alert job2 send Telegram channel2? help me!

@metalmatze
Copy link
Owner

Could you please elaborate on what your problem is?
Do you want to send to 2 different channels based on jobs?

@sandr30
Copy link
Author

sandr30 commented May 6, 2019

yes, other jobs and channels telegram.

@metalmatze
Copy link
Owner

Sorry, you really need to provide more information, otherwise I can't help you.

@sandr30
Copy link
Author

sandr30 commented May 27, 2019

Raised two telegrams bot and created two different groups to send to colleagues. The problem is that I cannot make routing alerts from productive servers to bot 1 telegrams, and test servers to bot 2 telegrams. These are two different bots for different groups in a cart. How to configure config?

@sandr30
Copy link
Author

sandr30 commented May 29, 2019

Сonf alertmanager.yml:

route:
  receiver: 'alertmananger-bot'
  routes:
    - match:
        env: dev
      receiver: alertmananger-bot2
    - receiver: 'alertmananger-bot'
      group_wait: 30s
      repeat_interval: 24h
      group_interval: 30s
templates:
- '/data/monitoring/alertmanager/alert.tmpl'
receivers:
- name: 'alertmananger-bot'
  webhook_configs:
  - send_resolved: true
    url: 'http://alertmanager-bot:8080'
- name: 'alertmananger-bot2'
  webhook_configs:
  - send_resolved: true
    url: 'http://alertmanager-bot:8085'

No work alert telegram http://alertmanager-bot:8085, help me? logs no error
 15-13-55

@sandr30
Copy link
Author

sandr30 commented May 30, 2019

level=error ts=2019-05-30T06:50:38.552339888Z caller=dispatch.go:264 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="Post http://alertmanager-bot:8085: dial tcp 172.18.0.6:8085: connect: connection refused" find error logs alertmanager. Help me

@metalmatze
Copy link
Owner

Seems like http://alertmanager-bot is not a valid DNS name. You need to put something in that the container is able to resolve.

@sandr30
Copy link
Author

sandr30 commented May 31, 2019

route:
receiver: 'alertmananger-bot'
routes:
- match:
env: dev
receiver: alertmananger-bot2
- receiver: 'alertmananger-bot'
group_wait: 30s
repeat_interval: 24h
group_interval: 30s
templates:

  • '/data/monitoring/alertmanager/alert.tmpl'
    receivers:
  • name: 'alertmananger-bot'
    webhook_configs:
  • name: 'alertmananger-bot2'
    webhook_configs:
    • send_resolved: true
      url: 'http://alertmanager-bot2:8080'
      No errors. but sends everything in alertmananger-bot2. And I want only messages DEV stand in alertmananger-bot2. alertmananger-bot in other messages. Help me

@thewilli
Copy link

If i get @sandr30's original idea right, the possibility to get a single instance of the bot to forward notifications to different users / groups depending on labels or parameters would be great.

My use case are different groups of people with different responsibilities, e.g. the network team isn't interested in a server's drive running out of space.

@metalmatze
Copy link
Owner

@thewilli, I see. I am a bit hesitant to put routing into the bot itself, when Alertmanager solves that problem already. Really not sure how to properly deal with that. Maybe we can send some additional information from Alertmanager to the bot, to still do most of the routing in Alertmanager.

@thewilli
Copy link

Sure, one shouldn't reeinvent the wheel. I'd just make use of labels:

The Alertmanager includes all labels in the POST request. The /start command could accept an optional parameter, containing key=value pairs:

  • /start
    would add the chat for all notifications, independent of the label
  • /start environment=prod
    would add the chat for all notifications with the environment label being of value prod
  • use comma-separated values to require multiple conditions (conjunctions):
    /start service=db,alertname=NoMasterLeft
  • use multiple invocations of /start to allow for options (disjunctions):
    /start environment=prod, /start criticality=severe
    will notify if either the environment was production or the criticality was severe

What do you think?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants