Prometheus Alertmanager 配置

问题描述 投票:0回答:1

我有以下配置,可以根据匹配的标签从我的普罗米修斯发送电子邮件警报。

global:
  smtp_from: '[email protected]'
  smtp_smarthost: '1.1.1.1:25'
  smtp_require_tls: false
templates:
- '/etc/alertmanager/default.tmpl'
route:
  receiver: 'default-receiver'
  group_by: [cluster, severity]
  group_wait: 10s
  group_interval: 5m
  repeat_interval: 1h
inhibit_rules:
- source_match:
    severity: critical
  target_match:
    severity: warning
  routes:
  - receiver: 'default-receiver'
  email_configs:
  - to: "[email protected],[email protected],[email protected],[email protected]"
    send_resolved: true
  - receiver: 'datalake-receiver'
  email_configs:
  - to: "[email protected],[email protected],[email protected]"
    match_re:
      kubernetes_namespace: datalake-aws-ec2|datalake-piaas-instances
    send_resolved: true
  - receiver: 'bundling-receiver'
  email_configs:
  - to: "[email protected],[email protected],[email protected],[email protected]"
    match_re:
      kubernetes_namespace: bundling-prod-axa-sg|rabbitmq
    send_resolved: true

我部署了此配置,但我的容器没有出现。有人可以帮我验证语法并建议上面的配置有什么问题吗?我尝试了所有可能的组合但没有运气。 预先感谢。

prometheus prometheus-alertmanager
1个回答
1
投票

有很多与 YAML 标识和 Alertmanager 配置格式相关的问题。以下配置似乎按预期工作:

global:
  smtp_from: '[email protected]'
  smtp_smarthost: '1.1.1.1:25'
  smtp_require_tls: false

templates:
- '/etc/alertmanager/default.tmpl'

route:
  receiver: 'default-receiver'
  group_by: [cluster, severity]
  group_wait: 10s
  group_interval: 5m
  repeat_interval: 1h

  routes:
    - receiver: 'datalake-receiver'
      match_re:
        kubernetes_namespace: 'datalake-aws-ec2|datalake-piaas-instances'
    - receiver: 'bundling-receiver'
      match_re:
        kubernetes_namespace: 'bundling-prod-axa-sg|rabbitmq'

receivers:
  - name: 'default-receiver'
    email_configs:
      - to: '[email protected]'
        send_resolved: true
      - to: '[email protected]'
        send_resolved: true

  - name: 'datalake-receiver'
    email_configs:
      - to: '[email protected]'
        send_resolved: true
      - to: '[email protected]'
        send_resolved: true

  - name: 'bundling-receiver'
    email_configs:
      - to: '[email protected]'
        send_resolved: true
      - to: '[email protected]'
        send_resolved: true

inhibit_rules:
  - source_match:
      severity: critical
    target_match:
      severity: warning

看看路由树编辑器。测试一下Alertmanager配置就好了。

© www.soinside.com 2019 - 2024. All rights reserved.