Prometheus Alertmanager dc 警报消息 onyl dc 团队

问题描述

我在不同位置的设备通过 Prometheus 和 alertmanager 跟踪它们,当 Prometheus alertmanager 触发时,它会转到所有团队。 当 Prometheus 生成警告时通知相关数据中心团队。在下面的例子中,我想要做的是将波士顿数据中心发生的问题报告给波士顿团队,我该怎么做? 谢谢。

普罗米修斯config.yml

    labels:
      dc: BOSTON
      name: BOS_APP_Server
      type: physical
  - targets:
    - 10.10.10.9:9100
    labels:
      dc: NEWY
      name: NEWY_APP_Server
      type: physical
  - targets:
    - 10.10.11.90:9100
    labels:
      dc: UTH
      name: UTH_FileServer
      type: physical
  - targets:
    - 10.10.12.99:9100` 
    

enter image description here

解决方法

您需要使用以下内容配置 Alertmanager:

route:
  # Default receiver
  receiver: 'report-team'
 
  routes:
    - receiver: 'boston-team'
      match_re:
        dc: BOSTON
 
    - receiver: 'newy-team'
      match_re:
        dc: NEWY
 
    - receiver: 'uth-team'
      match_re:
        dc: UTH
 
receivers:
  - name: 'report-team'
    email_configs:
      - to: 'REPORT-TEAM-EMAIL@SERVER'
 
  - name: 'boston-team'
    email_configs:
      - to: 'BOSTON-TEAM-EMAIL@SERVER'

  - name: 'newy-team'
    email_configs:
      - to: 'NEWY-TEAM-EMAIL@SERVER'

  - name: 'uth-team'
    email_configs:
      - to: 'UTH-TEAM-EMAIL@SERVER'

在 Alertmanager 配置 here 中查看更多信息。