Hello!
First I have to thank each and everyone here in the community - setting up and getting into the whole Grafana and InfluxDB topic would be impossible without you.
Now I’ve reached my first thing I can’t solve just by reading - please help. Thank you!
Background:
I’m currently rebuilding my power metering log from my APC UPS - this was done via InfluxDB v1.8 in the past - but I’d like to move over to v2.
- What Grafana version and what operating system are you using?
Docker - 9.3.4 - What are you trying to achieve?
Show the power usage of the last 7 days - get the data via a flux query and then show by day (or date) - How are you trying to achieve it?
Using a flux query and calculating the kWh - then showing it in a Bar Chart. - What happened?
The BarChart shows the correct data (kWh), but one day ahead.
E.g. I have data from the 25th but the data is shown on the 26th. - What did you expect to happen?
Data and date to match up on the cart. - Can you copy/paste the configuration(s) that you are having problems with?
This is my query:
import "timezone"
option location = timezone.location(name: "Europe/Vienna")
from(bucket: "ServerRack-UPS")
|> range(start: -1w)
|> filter(fn: (r) => r["_measurement"] == "upsd")
|> filter(fn: (r) => r["_field"] == "load_percent")
|> map(fn: (r) => ({r with _value: r._value * 720 / 100}))
|> aggregateWindow(
every: 1h,
fn: (tables=<-, column) =>
tables
|> integral(unit: 1h)
|> map(fn: (r) => ({ r with _value: r._value / 1000.0})))
|> aggregateWindow(every: 1d, fn: sum)
And this is how the chart looks:
Hope I opened this Topic the right way. Thanks very much in advance!