普罗米修斯如何使用多个标签

问题描述 投票:0回答:1

我有多个抓取,如何汇总这些结果,下面是我的示例:

{data="eth0",direction="sum",instance="localhost:21081",job="etha"} 111476 {data="eth0",direction="sum",instance="localhost:21082",job="etha"} 29163 {data="eth0",direction="sum",instance="localhost:21084",job="etha"} 10439

我使用以下语句,但没有效果:

sum_over_time(eth0{data="eth0",direction="sum",job="eth0"}[20m])

仍然有多行,我希望能够聚合成一行

prometheus
1个回答
0
投票

为什么不尝试以下命令?

sum (rate (sum_over_time{data="eth0",direction="sum",job="eth0"}[20m]))

如果你想根据一个唯一的字段对它求和,例如data =“eth0”可以有多个值,使用以下命令:

sum (rate (sum_over_time{data="eth0",direction="sum",job="eth0"}[20m])) by (data)
© www.soinside.com 2019 - 2024. All rights reserved.