'Prometheus query to alert if something happens x times within a time period?

I'm working on a query that should alert if the disk queue length gets above 2 frequently. Say, if it happens 10 times over a 1d period.

I can't seem to get my head around this one. I would first need the amount of times the issue occurs, so: count(windows_logical_disk_requests_queued > 2)

Then I'd need to check how many times this query occurred over the last 1d. How do I do that?



Solution 1:[1]

You can use count_over_time. Something like: count_over_time(windows_logical_disk_requests_queued[1d]) > 10

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1