nschile
1
I currently have a alert query based on Prometheus data. I first query that data,
scrape_samples_post_metric_relabeling{job!="prometheus"}
I then reduce the value to only look at the last value,
I then filter the values to only include hosts that contain a value that is greater than 7500
I now want to only trigger the alert if the number of hosts is greater than 5
. Does anyone have any ideas on how to do this? Thanks!
grant2
2
Welcome @nschile to the Grafana forum.
Maybe add this?
and then alert off expression D?
It may require an adjustment somewhere. Remember to run the queries and the preview the alerts and see what shows up.
nschile
3
That worked. Thanks for the assistance.
nschile
4
Actually, the $C > 5
didn’t work. It appears that $C
would only ever be 1 or 0. I need a way to determine how many hosts met criteria $C
grant2
5
OK, just winging it here, but maybe something like this…
Query A: scrape_samples_post_metric_relabeling{job!="prometheus"}
Expression B:
Expression C:
Alert off expression C
If you click Preview Alerts, you will be able to see the value in Expression B (i.e. the number of hosts that met criteria C