Quantcast
Channel: InfluxDB - Grafana Labs Community Forums
Viewing all articles
Browse latest Browse all 204

Question on grouping fields from influxdb

$
0
0

Hello all,

I have an InfluxDB with data from my inverter. Every time I restart my docker stack, a new filed “host” is added. For example data up until this point has the host value “a” (just an example, the actual value is longer), after the reboot its “b”.

This results in two gauges where only should be one (one for before the restart, the other one after) or in bar chars which are splitted.

for gauges where i show the current value I added a “group()” at the end of the query and that helped. but this doesn’t work with query where I sum up values over a certain time frame. Example: The following query should show the production of my solar panels for today:

from(bucket: “powermeter”)
|> range(start: today())
|> filter(fn: (r) => r[“_field”] == “P_PV”)
|> aggregateWindow(every: 1d, fn: integral)
|> map(fn: (r) => ({r with _value: r._value / 3600000.0, host: r.host})) // Include the “host” field in the mapping
|> group(columns: [“host”]) // Group by the “host” field

but I still see three gauges (as I restarted three times today).

Questions:

  • Can I get rid of the “host” field completely?
  • if not, how can I change the query above so that there is just one value returned?

Thanks in advance!
Bruno

4 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 204

Trending Articles