简体   繁体   English

普罗米修斯查询是否在一段时间内发生 x 次警报?

[英]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.我正在处理一个查询,如果磁盘队列长度经常超过 2,它应该发出警报。 Say, if it happens 10 times over a 1d period.比如说,如果它在 1d 时间内发生 10 次。

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)我首先需要问题发生的次数,因此: count(windows_logical_disk_requests_queued > 2)

Then I'd need to check how many times this query occurred over the last 1d.然后我需要检查这个查询在过去 1 天内发生了多少次。 How do I do that?我怎么做?

You can use count_over_time .您可以使用count_over_time Something like: count_over_time(windows_logical_disk_requests_queued[1d]) > 10类似于: count_over_time(windows_logical_disk_requests_queued[1d]) > 10

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM