【问题标题】:Blackbox Exporter alert with value of the "probe_http_status_code" metric具有“probe_http_status_code”指标值的 Blackbox Exporter 警报
【发布时间】:2019-11-23 03:53:33
【问题描述】:

目前我设置了一个简单的警报规则,它使用 Blackbox Exporter 中的“probe_success”指标在探测失败时发出警报,这很明显。

要求是失败请求的状态代码包含在警报中。因此,与其只说“... is down”,还应该在其中包含状态代码(“probe_http_status_code”),例如“... is down (500)”。

因为状态码是“probe_http_status_code”的值,所以无法同时加入“probe_success”和“probe_http_status_code”的标签来得到我想要的结果。

我还了解到,指标值不能作为标签加入,这令人失望。 https://github.com/prometheus/prometheus/issues/2393

关于将 PromQL 表达式作为单独标签传递给警报规则本身,我也没有发现任何其他内容。

我知道我没有写太多“你已经尝试了什么?”这里的例子,但老实说,我到处都在尝试让这个工作正常进行,但我没有任何可靠的“我已经尝试过”的例子”。

【问题讨论】:

    标签: prometheus prometheus-alertmanager prometheus-blackbox-exporter


    【解决方案1】:

    您可以为此使用and

    probe_http_status_code and probe_success == 0

    因为两个指标具有相同的标签。然后警报表达式的值将成为状态代码。

    【讨论】:

      猜你喜欢
      • 2021-04-26
      • 2022-10-25
      • 1970-01-01
      • 2018-12-01
      • 2014-08-29
      • 1970-01-01
      • 2020-11-23
      • 2020-06-11
      • 2021-07-15
      相关资源
      最近更新 更多