AlertManager 停机警报,除非 429(To Many Requests)HTTP 状态码

AlertManager downtime alert unless 429 (To Many Requests) HTTP status code

目前我有一个 AlertManager 配置,当“probe_success”指标为 0 时,它只发送警报。

我不知道如何在警报规则的“expr”字段中加入“probe_http_status_code”指标和“probe_success”指标以保持当“probe_success”度量为 0 时发出警报,因为 429(对许多请求)HTTP 状态代码。

我尝试使用下面的类似问题来解决这个问题,但没有成功。
How can I 'join' two metrics in a Prometheus query?

"probe_success" 和 "probe_http_status_code" 都是 Blackbox Exporter 指标。

这里您可能想要的是 valid_status_codes,因此您可以将 429(加上预期的任何 2xx 代码)指定为有效,这将使 probe_success 在它们发生时保持为 1。