Grafana 选择多台主机收集的cpu总量
我使用collected和influx来监控200个核心的集群 我想在grafana中创建一个量表,将所有主机的所有load_短期值相加,以查看集群的总使用率 我的结构如下所示:Grafana 选择多台主机收集的cpu总量,grafana,influxdb,collectd,Grafana,Influxdb,Collectd,我使用collected和influx来监控200个核心的集群 我想在grafana中创建一个量表,将所有主机的所有load_短期值相加,以查看集群的总使用率 我的结构如下所示: name: load_shortterm time host metric type value ---- ---- ------ ---- ----- 1601891780201909599 cpu007.cl
name: load_shortterm
time host metric type value
---- ---- ------ ---- -----
1601891780201909599 cpu007.cluster load 0
1601891790145618383 cpu001.cluster load 2
1601891790163106767 cpu002.cluster load 0.03
1601891790167701326 cpu009.cluster load 0
所以我想有一个请求,在这种情况下,它将回答2.03
我不知道如何获取每个主机的最后一个值并求和。我试过这个:
select sum(*) from load_shortterm where "host" =~ /^*.cluster/
但它返回所有值的总和
你能帮帮我吗
谢谢
RB
SUM
allLAST
带有子查询的值,例如:
SELECT SUM(last)
FROM (
SELECT LAST(value)
FROM load_shortterm
WHERE "host" =~ /^*.cluster/
)
感谢您的回复,子查询将返回每个主机的最后一个值,而不是最后一个值:
> select last(value) from load_shortterm where "host" =~ /^*.cluster/
name: load_shortterm
time last
---- ----
1605863555866457205 0
对于完整查询,结果是相同的,它似乎不接受所有最后的值,而只接受最后一个值:
> select sum(last) from (select last(value) from load_shortterm where "host" =~ /^*.cluster/)
name: load_shortterm
time last
---- ----
1605863555866457205 0