prometheusprometheus-alertmanagerprometheus-operatorprometheus-node-exporterprometheus-blackbox-exporter

Prometheus : How to check if there is atleast one time series for a given metric and label combination?


I have metric, LATENCY and label, status. I want to fire an alert when LATENCY has status=CRITICAL

LATENCY{status="CRITICAL"}

LATENCY status will be critical only if latency is beyond a threshold. How to check if there is at least one time series with LATENCY{status="CRITICAL"} ?

I used expr: absent(LATENCY{status="CRITICAL"}) == 0, but it doesn't work.


Solution

  • First you could try the following expression:

    count(LATENCY{status="CRITICAL"}) > 0
    

    If it doesn't work as expected, then try the following one:

    count(LATENCY{status="CRITICAL"} or vector(0)) > 1