【问题标题】:Prometheus Alertmanager is always sending notificationsPrometheus Alertmanager 总是发送通知
【发布时间】:2022-01-06 08:52:06
【问题描述】:

alertmanager 有什么方法可以在触发警报后停止连续触发警报?

例如,我设置了一些警报规则来检查服务的正常运行时间。如果其中一项服务出现故障,则 alertmanager 将不会停止发送警报消息,直到问题得到解决。

【问题讨论】:

    标签: prometheus prometheus-alertmanager


    【解决方案1】:

    您描述的是inhibition rule。当其他警报触发时,它可以抑制警报。以下是 Alertmanager 最新版本的基本示例:

    # for alerts with equal 'instance' label
    - equal: ['instance']
    # if one has 'severity' label equal to 'critical'
      source_matchers:
        - severity = critical
    # and the other has 'warning'
      target_matchers:
        - severity = warning
    # then mute the other one (with severity 'warning')
    

    已弃用的旧样式:

    - equal: ['instance']
      source_match:
        severity: critical
      target_match:
        severity: warning
    

    【讨论】:

    • 感谢您的回复!尽管警报消息不断出现,但我在 alertmanager 的 .yml 中应用了上述内容。我认为必须在 Prometheus 方面做一些事情,因为似乎从 Prometheus 提供给 alertmanager 的每条规则都正在发送。
    • @agelosnm 不,Prometheus 无论如何都会继续发送警报。由 Alertmanager 决定是否邮寄。我猜要么是规则匹配器不工作,要么是相同的警报不断出现,重复间隔(另一个设置)太低。
    • 好的明白了!实际上,警报间隔是 20 秒。这是因为“不断地”检查正常运行时间。
    • @agelosnm 检查频率取决于您提取指标 (scrape_config/scrape_interval) 和评估规则 (rule_group/interval) 的频率。这些是在 Prometheus 中配置的。 Alertmanager 有route/repeat_interval,它定义了提醒您现有警报的频率。这不会检查正常运行时间,它只是向您发送提醒。检查所有这些。
    • 非常感谢您提供的有用的 cmets!很多事情在我脑海中清晰。关于最初的问题,确实我在 10 秒时启用了组间隔,因此该服务一直在发送消息!我禁用了它,一切似乎都很好。再一次感谢你! :D
    猜你喜欢
    • 2020-10-21
    • 1970-01-01
    • 2022-01-16
    • 1970-01-01
    • 1970-01-01
    • 2022-07-13
    • 1970-01-01
    • 2016-03-15
    • 2021-11-25
    相关资源
    最近更新 更多