Monitoring Prometheus alertmanager向多个松弛通道发送通知

Monitoring Prometheus alertmanager向多个松弛通道发送通知,monitoring,prometheus,prometheus-alertmanager,Monitoring,Prometheus,Prometheus Alertmanager,我们有两个不同的团队处理不同的应用程序。我想通过使用相同的警报表达式向不同的空闲通道发送警报通知。我找到了一些示例,但不明白在尝试添加新路由时使用receiver:'default'的主要原因是什么?这一点的作用是什么?如果ı改变这一点,它会影响什么 同时,如果您能帮助我如何将通知发送到多个空闲频道,我们将不胜感激。。新的是我试过的 当前alertmanager.yml receivers: - name: 'team-1' slack_configs: - api_url:

我们有两个不同的团队处理不同的应用程序。我想通过使用相同的警报表达式向不同的空闲通道发送警报通知。我找到了一些示例,但不明白在尝试添加新路由时使用
receiver:'default'
的主要原因是什么?这一点的作用是什么?如果ı改变这一点,它会影响什么

同时,如果您能帮助我如何将通知发送到多个空闲频道,我们将不胜感激。。新的是我试过的

当前alertmanager.yml

receivers:
  - name: 'team-1'
    slack_configs:
    - api_url: 'https://hooks.slack.com/services/1'
      channel: '#hub-alerts'
route:
  group_wait: 10s
  group_interval: 5m
  receiver: 'team-1'
  repeat_interval: 1h
  group_by: [datacenter]
alertmanager.yml:
    receivers:
      - name: 'team-1'
        slack_configs:
        - api_url: 'https://hooks.slack.com/services/1'
          channel: '#channel-1'
          send_resolved: true
      
      - name: 'team-2'
        slack_configs:
        - api_url: 'https://hooks.slack.com/services/2'
          channel: '#channel-2'
          send_resolved: true

route:
  group_wait: 10s
  group_interval: 5m
  repeat_interval: 1h
  group_by: [datacenter]
  receiver: 'default'
  routes:
  - receiver: 'team-1'
  - receiver: 'team-2'

新alertmanager.yml

receivers:
  - name: 'team-1'
    slack_configs:
    - api_url: 'https://hooks.slack.com/services/1'
      channel: '#hub-alerts'
route:
  group_wait: 10s
  group_interval: 5m
  receiver: 'team-1'
  repeat_interval: 1h
  group_by: [datacenter]
alertmanager.yml:
    receivers:
      - name: 'team-1'
        slack_configs:
        - api_url: 'https://hooks.slack.com/services/1'
          channel: '#channel-1'
          send_resolved: true
      
      - name: 'team-2'
        slack_configs:
        - api_url: 'https://hooks.slack.com/services/2'
          channel: '#channel-2'
          send_resolved: true

route:
  group_wait: 10s
  group_interval: 5m
  repeat_interval: 1h
  group_by: [datacenter]
  receiver: 'default'
  routes:
  - receiver: 'team-1'
  - receiver: 'team-2'


您需要将路由上的continue属性设置为true。默认情况下,它是false

AlertManager的默认行为是遍历路由以获得匹配,并在找到匹配的第一个节点处退出

您要做的是在比赛中发出警报,并继续搜索其他比赛,然后也发出警报

相关文件科:

使用此方法的示例如下:

在上面的例子中,以防它断裂

# alertmanager.yml

route:
  # When a new group of alerts is created by an incoming alert, wait at
  # least 'group_wait' to send the initial notification.
  # This way ensures that you get multiple alerts for the same group that start
  # firing shortly after another are batched together on the first
  # notification.
  group_wait: 10s

  # When the first notification was sent, wait 'group_interval' to send a batch
  # of new alerts that started firing for that group.
  group_interval: 5m

  # If an alert has successfully been sent, wait 'repeat_interval' to
  # resend them.
  repeat_interval: 30m

  # A default receiver
  receiver: "slack"

  # All the above attributes are inherited by all child routes and can
  # overwritten on each.
  routes:
    - receiver: "slack"
      group_wait: 10s
      match_re:
        severity: critical|warning
      continue: true

    - receiver: "pager"
      group_wait: 10s
      match_re:
        severity: critical
      continue: true

receivers:
  - name: "slack"
    slack_configs:
      - api_url: 'https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/xxxxxxxxxxxxxxxxxxxxxxxxxxx'
        send_resolved: true
        channel: 'monitoring'
        text: "{{ range .Alerts }}<!channel> {{ .Annotations.summary }}\n{{ .Annotations.description }}\n{{ end }}"

  - name: "pager"
    webhook_config:
      - url: http://a.b.c.d:8080/send/sms
        send_resolved: true
#alertmanager.yml
路线:
#当传入警报创建新的警报组时,请在等待
#发送初始通知的“组等待”最少。
#这样可以确保您为启动的同一组获得多个警报
#一次又一次的射击在第一个炮台上分批进行
#通知。
分组等待:10秒
#发送第一个通知时,请等待“group_interval”发送批处理
#为该组启动的新警报的数量。
组间隔:5m
#如果警报已成功发送,请等待“repeat_interval”发送至
#重新发送它们。
重复间隔:30米
#默认接收者
接受者:“松弛”
#上述所有属性均由所有子路由继承,并且可以
#在每个页面上覆盖。
路线:
-接受者:“松弛”
分组等待:10秒
匹配:
严重性:严重警告
继续:对
-接收器:“寻呼机”
分组等待:10秒
匹配:
严重程度:严重
继续:对
接收人:
-名称:“松弛”
slack\u配置:
-api_url:'https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/xxxxxxxxxxxxxxxxxxxxxxxxxxx'
发送解决方案:正确
频道:“监控”
文本:“{range.Alerts}}{{.Annotations.summary}}\n{{{.Annotations.description}}\n{{end}”
-姓名:“寻呼机”
webhook_配置:
-网址:http://a.b.c.d:8080/send/sms
发送解决方案:正确

您需要将路由上的continue属性设置为true。默认情况下,它是false

AlertManager的默认行为是遍历路由以获得匹配,并在找到匹配的第一个节点处退出

您要做的是在比赛中发出警报,并继续搜索其他比赛,然后也发出警报

相关文件科:

使用此方法的示例如下:

在上面的例子中,以防它断裂

# alertmanager.yml

route:
  # When a new group of alerts is created by an incoming alert, wait at
  # least 'group_wait' to send the initial notification.
  # This way ensures that you get multiple alerts for the same group that start
  # firing shortly after another are batched together on the first
  # notification.
  group_wait: 10s

  # When the first notification was sent, wait 'group_interval' to send a batch
  # of new alerts that started firing for that group.
  group_interval: 5m

  # If an alert has successfully been sent, wait 'repeat_interval' to
  # resend them.
  repeat_interval: 30m

  # A default receiver
  receiver: "slack"

  # All the above attributes are inherited by all child routes and can
  # overwritten on each.
  routes:
    - receiver: "slack"
      group_wait: 10s
      match_re:
        severity: critical|warning
      continue: true

    - receiver: "pager"
      group_wait: 10s
      match_re:
        severity: critical
      continue: true

receivers:
  - name: "slack"
    slack_configs:
      - api_url: 'https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/xxxxxxxxxxxxxxxxxxxxxxxxxxx'
        send_resolved: true
        channel: 'monitoring'
        text: "{{ range .Alerts }}<!channel> {{ .Annotations.summary }}\n{{ .Annotations.description }}\n{{ end }}"

  - name: "pager"
    webhook_config:
      - url: http://a.b.c.d:8080/send/sms
        send_resolved: true
#alertmanager.yml
路线:
#当传入警报创建新的警报组时,请在等待
#发送初始通知的“组等待”最少。
#这样可以确保您为启动的同一组获得多个警报
#一次又一次的射击在第一个炮台上分批进行
#通知。
分组等待:10秒
#发送第一个通知时,请等待“group_interval”发送批处理
#为该组启动的新警报的数量。
组间隔:5m
#如果警报已成功发送,请等待“repeat_interval”发送至
#重新发送它们。
重复间隔:30米
#默认接收者
接受者:“松弛”
#上述所有属性均由所有子路由继承,并且可以
#在每个页面上覆盖。
路线:
-接受者:“松弛”
分组等待:10秒
匹配:
严重性:严重警告
继续:对
-接收器:“寻呼机”
分组等待:10秒
匹配:
严重程度:严重
继续:对
接收人:
-名称:“松弛”
slack\u配置:
-api_url:'https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/xxxxxxxxxxxxxxxxxxxxxxxxxxx'
发送解决方案:正确
频道:“监控”
文本:“{range.Alerts}}{{.Annotations.summary}}\n{{{.Annotations.description}}\n{{end}”
-姓名:“寻呼机”
webhook_配置:
-网址:http://a.b.c.d:8080/send/sms
发送解决方案:正确