定义不存在警报 Prometheus

Define absence of the alert Prometheus

我已将 Prometheus 警报设置为取决于另一个警报是否没有价值:

  - alert: Some_Alert
    expr: |
      round(some_expr) > 24
      AND ALERTS{alertname="Empty_Source_Data_Load"} != 1

我只想在第一个表达式为真且 Empty_Source_Data_Load 警报不存在(这意味着有数据)时计算 Some_Alert 值。我怎样才能使用不存在的方法来做到这一点?

您不会使用 absent,而是使用 unless 二元运算符。

vector1 unless vector2 results in a vector consisting of the elements of vector1 for which there are no elements in vector2 with exactly matching label sets. All matching elements in both vectors are dropped.

警报将类似于以下内容(带有 ON() 子句):

  - alert: Some_Alert
    expr: |
      round(some_expr) > 24
      UNLESS ON() ALERTS{alertname="Empty_Source_Data_Load"}