prometheus - 在从事件更改为非事件之前延迟 Prometheus 警报

标签 prometheus prometheus-alertmanager

我的 Prometheus 设置中有一个警报,它会在 someMetric > 100 时发送警报已对 5m 有效然后每隔 24h 重新发送警报根据下面的配置:

prometheus-alert.yml

 - alert: TestAlert
          expr: someMetric > 100
          for: 5m

警报管理器-config.yml
repeat_interval: 24h

然而someMetric有一种行为,它可以在 100 以上“稳定”(这意味着警报处于事件状态),但每隔一段时间它会在跳回到 100 以上之前下降到 100 以下的某个值,然后再跳回到 100 以上。这将导致事件警报变为非事件状态(已解决),然后在 5 分钟后返回待处理状态并再次处于事件状态。这将导致 Prometheus 重新发送警报,这是我想要避免的。

有没有办法将 Prometheus 配置为具有类似于 for: 5m 的内容? , 但对于转换 active -> inactive (resolved)?

最佳答案

您可以使用 aggregation-over-time 之一在您的示例中,promQL 函数可以“过滤掉”低于 100 的光点?在您的情况下,听起来 max 可能有用吗?唯一的缺点是,一旦该值永久降至 100 以下,结束警报可能需要几分钟的时间。

- alert: TestAlert
      expr: max_over_time(someMetric[2m]) > 100
      for: 5m

关于prometheus - 在从事件更改为非事件之前延迟 Prometheus 警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61248297/

相关文章:

prometheus - Prometheus 中的高基数标签有多危险?

docker - 如何配置Prometheus consul_sd_configs使用https做服务

kubernetes - 如何使用 Prometheus Alert Manager 在 Kubernetes 中触发警报

kubernetes - Prometheus kube_pod_container_status_waiting_reason 没有捕获到 pod CrashLoopBackOff 原因

prometheus - 如何使用 prometheus-am-executor 运行 shell 脚本

kubernetes - 如何在 Kubernetes 中使用 Prometheus 和 AWS EBS?

kubernetes - 裸机(Bare Metal)上的Thanos

java - 使用 Marathon/Mesos 的 Prometheus 动态端口服务发现

prometheus-alertmanager - 警报管理器 : custom receiver or webhook receiver with custom POST payload?