I am using collectd and influx for monitoring a cluster of 200 cores.
I would like to create a gauge in grafana which is adding all load_shortterm value of all hosts to see the total usage of the cluster.
My structure looks like this :
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
So I want to have a request which will answer 2.03 in this case.
I don't understand how to get last values for each host and sum it. I tried this :
select sum(*) from load_shortterm where "host" =~ /^*.cluster/
But it returns a sum of all values.
Can you please help me ?
Thanks,
RB
SUMallLASTvalues with subquery, e.g.: