How to find sum of top two rows on influxdb

I have telegraf collect process count across few machines. The collected data in influx db is in the format

time processa_name count host
123434 telegraf 1 host1
123435 telegraf 1 host2
123334 telegraf 1 host1
123335 telegraf 1 host2

How could I find the current count across all hosts (here is 2)? Basically I need sum of last of count. Any help is appriciated.


Have you tried something like:

select sum(last) from (select last(count) from table group by host)

…presumably with an appropriate time condition as well?


cool, that helps, with correct time window selecting it works… thanks Antony

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.