alertmanager配置文件詳解


global:
  smtp_smarthost: 'localhost:25'
  smtp_from: 'alertmanager@example.org'         #用於郵件通知的P發件人
route:                                          #每個輸入警報進入根路由
  receiver: 'team-X-mails'                      #根路由不得包含任何匹配項,因為它是所有警報的入口點
  group_by: ['alertname', 'cluster']            #將傳入警報分組的標簽。例如,將有個針對cluster = A和alertname = LatencyHigh的警報進入批處理成一個組
  group_wait: 30s                               #當傳入的警報創建了一組新的警報時,請至少等待多少秒發送初始通知
  group_interval: 5m                            #發送第一個通知時,請等待多少分鍾發送一批已開始為該組觸發的新警報
  repeat_interval: 3h                           #如果警報已成功發送,請等待多少小時以重新發送警報
  routes:                                       #子路由,父路由的所有屬性都會被子路由繼承
  - match_re:                                   #此路由在警報標簽上執行正則表達式匹配,以捕獲與服務列表相關的警報
      service: ^(foo1|foo2|baz)$
    receiver: team-X-mails
    routes:                                     #服務有嚴重警報,任何警報子路徑不匹配,即通過父路由配置直接發送給收件人
    - match:
        severity: critical
      receiver: team-X-pager
    routes:                                      #此路由處理來自數據庫服務的所有警報
    - match:
        severity: critical
      receiver: team-Y-pager
  - match:
      service: database
    receiver: team-DB-pager                       #還可以按受影響的數據庫對警報進行分組
    group_by: [alertname, cluster, database]
    routes:
    - match:
        owner: team-X
      receiver: team-X-pager
#如果另一個警報正在觸發,則禁止規則允許將一組警報靜音,如果同一警報已經嚴重,我們將使用此選項禁用任何警告級別的通知 
inhibit_rules:
- source_match:
    severity: 'critical'
  target_match:
    severity: 'warning'
  equal: ['alertname']
#如果警報名稱相同,則應用抑制,如果源警報和目標警報中均缺少“equal”中列出的所有標簽名稱,則將應用禁止規則!
receivers:
- name: 'team-X-mails'
  email_configs:
  - to: 'team-X+alerts@example.org, team-Y+alerts@example.org'
- name: 'team-X-pager'
  email_configs:
  - to: 'team-X+alerts-critical@example.org'
  pagerduty_configs:
  - routing_key: <team-X-key>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM