PromQL - detect flapping value

37 views
Skip to first unread message

Marek Fiala

unread,
Apr 19, 2020, 3:09:53 PM4/19/20
to Prometheus Users
Hi,

what is the best way to detect value flapping?

For example: I want to create an alert when load was higher than some threshold more than 10 times in last 24 hours.

Thank you.


Julien Pivotto

unread,
Apr 19, 2020, 3:14:55 PM4/19/20
to Marek Fiala, Prometheus Users
- record: load:gt_10:10m
expr: min_over_time(load_metric[10m]) > 10
- alert: LoadTooHighFor10m
expr: count_over_time(load:gt_10:10m[24h])

>
>
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/97d84202-f84c-49a3-9e03-eed64f90295d%40googlegroups.com.


--
(o- Julien Pivotto
//\ Open-Source Consultant
V_/_ Inuits - https://www.inuits.eu
signature.asc

Marek Fiala

unread,
Apr 20, 2020, 2:25:10 AM4/20/20
to Prometheus Users
This is my load expression: 
avg(node_load1) / count(count(node_cpu_seconds_total) by (cpu)) * 100

I'm not sure, how to convert it to range vector.

Thank you.


On Sunday, April 19, 2020 at 9:14:55 PM UTC+2, Julien Pivotto wrote:
On 19 Apr 12:09, Marek Fiala wrote:
> Hi,
>
> what is the best way to detect value flapping?
>
> For example: I want to create an alert when load was higher than some
> threshold more than 10 times in last 24 hours.
>
> Thank you.

- record: load:gt_10:10m
  expr:  min_over_time(load_metric[10m]) > 10
- alert: LoadTooHighFor10m
  expr: count_over_time(load:gt_10:10m[24h])

>
>
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to promethe...@googlegroups.com.

Brian Candler

unread,
Apr 20, 2020, 3:18:40 AM4/20/20
to Prometheus Users
On Monday, 20 April 2020 07:25:10 UTC+1, Marek Fiala wrote:
This is my load expression: 
avg(node_load1) / count(count(node_cpu_seconds_total) by (cpu)) * 100

I'm not sure, how to convert it to range vector.


Use a subquery.  It looks almost like a range vector, but add [10m:] instead of [10m]. Wrap your expression in parentheses first.
Reply all
Reply to author
Forward
0 new messages