所有实例的Prometheus grafana告警查询

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

我是grafana和prometheus的新手, 我只是想知道,有没有人知道是否可以设置一个带有查询多个不同实例的查询的警报,并在其中一个实例达到阈值集时发送警报。

我为每个实例设置了许多警报,我想尽量减少警报任何帮助表示赞赏,谢谢。

prometheus grafana grafana-alerts
1个回答
0
投票

您的警报规则可以使用不同实例的指标。

最简单的例子:

 # Alert for any instance that is unreachable.
  - alert: InstanceDown
    expr: up == 0
    annotations:
      summary: "Instance {{ $labels.instance }} down"
      description: "{{ $labels.instance }} of job {{ $labels.job }} is down."

此警报规则检查指标

up
是否为任何一组标签返回 0。如果是这样,将使用与您的指标相同的一组标签(以及一些额外的标签)来创建警报。

如果 metric

up
为多组指标返回 0 - 将为每组指标创建警报。

如您所见,示例警报规则包括摘要和描述。它们是根据初始指标的标签

instance
job
生成的。

应用规则的演示示例可以在prometheus.demo.do.prometheus.io看到

更多关于 alertingrecording 规则的配置,请阅读官方文档。

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