Search code examples
prometheusgrafanagrafana-alerts

Grafana alert / value equals zero


I have the prometheus query = sum by (job) (rate(http_requests_total[5m]))

Could you tell how can I create alert in grafana when the value is equal zero (longer than given time)

I cannot find proper function


Solution

  • Let's say you want an alert to fire when the 5m average has been zero for more than 5 minutes:

    enter image description here

    If you dislike the is below 0.01 you can turn the query into a boolean one like so:

    sum by (job) (rate(http_requests_total[5m])) == bool 0
    

    Now you will get a 1 if the rate is 0 and 0 if the rate is not 0.