Sum last of series

I am new to influx and having a hard time groking the right way to achieve what I am wanting to do. I am sending in a value that I want all the hosts who send it to sum the last entry. I am sending data in every 30 seconds to influx. Grafana will be used to display this data as a single stat and graph. I autorefresh the grafana page every minute. Data is as follows:

time host ip value

I want the last of each hosts entry. I am confused if I need a continuous query a nested query or whats the best method for me to accomplish this. I have a number of data sets I need to do this with. Let me know if I need to share anymore data

The best query I could come up with so far and do not really think its helpful for my end goal is as follows.

select value from “1year”.“data” group by * order by desc limit 1

Any hints or RTFM with a link to something specific that might help me understand how to do this? What I find in the docs currently is not helping me as I think I am stuck in graphite thought process.

The last function should get you the “Last” entries for each host

You can run nested query to sum the final data e.g.

SELECT sum(last) from (select last(value) from group by host )

1 Like

Perfect, thank you!

This helped me figure out what I was not grasping now to turn into a continuous query.

SELECT sum(last) from (select last(value) from temp group by host)