[feature request] Support multiple values in rules

660 views
Skip to first unread message

itang

unread,
Apr 9, 2018, 11:39:38 PM4/9/18
to Prometheus Users
Hi, 
    Can prometheus support multiple values in one alert rule?
Just like this:

-----
- alert: cpu_load_warning
    expr: |
      node_load5 > 2
      and instance:cpu_load5_per_core:avg > 1
      and instance:cpu_usage:quantile > 60
-----

-----
  - alert: cpu_use_warning
    expr: |
      instance:cpu_usage:quantile > 70
      and instance:cpu_load5_per_core:avg > 1
-----


Now the rules only get the value top left, I have to define multiple alerting rules?
If supports multiple values, I only need define these in one alerting rule, and can get much more info.

Thank you!

Brian Brazil

unread,
Apr 10, 2018, 2:47:31 AM4/10/18
to itang, Prometheus Users
You need to define at least one alert per alertname you want.

--

itang

unread,
Apr 11, 2018, 3:15:40 AM4/11/18
to Prometheus Users
hi Brian,
   I mean. In on alertname, could I get all the values beside the "and"? Not only the left one.


在 2018年4月10日星期二 UTC+8下午2:47:31,Brian Brazil写道:

Brian Brazil

unread,
Apr 11, 2018, 3:19:31 AM4/11/18
to itang, Prometheus Users
On 11 April 2018 at 08:15, itang <shoubi...@gmail.com> wrote:
hi Brian,
   I mean. In on alertname, could I get all the values beside the "and"? Not only the left one.

An sample can only have one value, so you can only get the left side.

Brian
 


在 2018年4月10日星期二 UTC+8下午2:47:31,Brian Brazil写道:
On 10 April 2018 at 04:39, itang <shoubi...@gmail.com> wrote:
Hi, 
    Can prometheus support multiple values in one alert rule?
Just like this:

-----
- alert: cpu_load_warning
    expr: |
      node_load5 > 2
      and instance:cpu_load5_per_core:avg > 1
      and instance:cpu_usage:quantile > 60
-----

-----
  - alert: cpu_use_warning
    expr: |
      instance:cpu_usage:quantile > 70
      and instance:cpu_load5_per_core:avg > 1
-----


Now the rules only get the value top left, I have to define multiple alerting rules?
If supports multiple values, I only need define these in one alerting rule, and can get much more info.

You need to define at least one alert per alertname you want.

--

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/923f2201-cd47-45c7-b1ca-897e886cfb27%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

itang

unread,
Apr 11, 2018, 3:38:54 AM4/11/18
to Prometheus Users
OK, is there a plan to support get other values?  Just for display.

Thanks.


在 2018年4月11日星期三 UTC+8下午3:19:31,Brian Brazil写道:
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.



--

Brian Brazil

unread,
Apr 11, 2018, 3:42:50 AM4/11/18
to itang, Prometheus Users
On 11 April 2018 at 08:38, itang <shoubi...@gmail.com> wrote:
OK, is there a plan to support get other values?  Just for display.

No, that wouldn't make any sense. You want two alerting rules.

Brian
 
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/54d38977-cc31-4d75-a2db-3a771c96f2b9%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

f...@efficks.com

unread,
Mar 4, 2019, 10:10:36 AM3/4/19
to Prometheus Users
Brian,
Can you explain more your point of view? I think of many examples when this actually WILL MAKE sense. I think it would be usefull to support multiple sample in prometheus.

Thank you
François-Xavier Choinière



--

Ben Kochie

unread,
Mar 4, 2019, 11:26:58 AM3/4/19
to f...@efficks.com, Prometheus Users
Prometheus PromQL can only ever produce one value per query unique label combination.

You can execute queries in annotations to get additional values.

annotations:
  description: "{{ printf \"instance:cpu_load5_per_core:avg{instance='%s'}\" .Labels.instance | query | first | value }}"

Reply all
Reply to author
Forward
0 new messages