警报管理器电子邮件通知不起作用

时间:2021-01-11 11:52:35

标签: prometheus slack email-notifications prometheus-alertmanager

我有以下 alertmanager.yml 可以将警报发送到 Mail 和 Slack 频道。在这里,我收到了有关 slack 的警报,但是我没有在进入 slack 的同时收到电子邮件警报。我的警报管理器容器日志中没有显示错误。

global:
  resolve_timeout: 5m
  smtp_smarthost: 'smtp.server.com:25'
  smtp_from: 'user@company.com'
  http_config:
    tls_config:
      insecure_skip_verify: true
      
route:
  group_wait: 10s
  group_interval: 30s
  repeat_interval: 30m

  # A default receiver
  receiver: "email"

  # 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: "email"
      group_wait: 10s
      match_re:
        severity: critial
      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: "email"
    email_configs:
      - to: 'reciever@company.com'
        send_resolved: true
        auth_username: 'user@company.com'
        auth_identity: 'user@company.com'
        auth_password: 'password'

但是,按照此链接 Mail notification 单独配置电子邮件是有效的。

1 个答案:

答案 0 :(得分:0)

如果警报与第一条路线匹配,则不会将其发送到第二条路线。

使用 Routing tree editor 可视化路由树。

注意:“severity: critial”行中有一个拼写错误。