【问题标题】:Grafana - Promql cumulative graphGrafana - Promql 累积图
【发布时间】:2021-12-07 14:06:46
【问题描述】:

这似乎是一件很容易做到的事情。然而我无法绕开它。

我根据过去 15 秒的平均 CPU 利用率进行了一些计算,并根据该计算得到一个值。不,我想要在 Grafana 中显示累积结果的图表。例如

Time passed Current result Cumulative result
15s 5 5
30s 7 12
45s 6 18

目前我的查询类似于:

sum (((1 - (avg by (cpu, instance) (rate(node_cpu_seconds_total{mode="idle"}[15s])))) * 2 + 4

这会导致绘制当前结果的图表。但我想要一个绘制累积结果的查询。当我尝试用 sum_over_time 包装整个查询时,出现以下异常:“调用函数“sum_over_time”时的预期类型矩阵,得到向量”

感谢您的帮助

【问题讨论】:

    标签: prometheus grafana promql


    【解决方案1】:

    Prometheus 中的 PromQL 不支持累积计算函数。如果你需要累积计算,那就试试VictoriaMetrics吧——它的查询语言——MetricsQL——提供了running_sum()函数。

    【讨论】:

      猜你喜欢
      • 2019-05-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-03
      • 2014-06-21
      相关资源
      最近更新 更多