Hi,
I’m trying to dsiplay the daily input and output of my Fritzbox in a Grafana Dashboard.
from(bucket: “homeassistant_stage”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“entity_id”] == “fritz_box_7590_ax_b_received”)
|> filter(fn: (r) => r[“_field”] == “value”)
|> filter(fn: (r) => r[“_measurement”] == “B”)
|> aggregateWindow(every: 1d, fn: mean, createEmpty: false)
|> yield(name: “mean”)
I’m getting the correct data in the output table, however I’m struggeling with the conversion part ?
Any help would be much appreciated.
Thanks, Andreas
grant1
February 3, 2023, 4:31pm
2
Thanks for the link. I’ve seen that, but it gives me an error.
from(bucket: “homeassistant_stage”)
range(start: -10m)
filter(fn: (r) => r._measurement == “B” and r.entity_id == “fritz_box_7590_ax_b_received”)
map(fn: (r) => ({r with _value: r._value / 1073741824}))
grant1
February 4, 2023, 11:12pm
4
Hi @1192410
My guess is that your _value
is actually being stored as a string. I think you could use the |> toInt()
function and make it work. Can you try this?
from(bucket: "homeassistant_stage")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "B" and r.entity_id == "fritz_box_7590_ax_b_received")
|> toInt()
|> map(fn: (r) => ({r with _value: r._value / 1073741824}))
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: “mean”)
Thanks @grant1 . I have tried it, but still an error.
grant1
February 5, 2023, 12:40pm
6
@1192410 It definitely seems that the _value column is a string (instead of an integer). I read through this post and the conclusion seemed to be to re-populate the data correctly.
The error you received references a column called “data_size”, but I do not see that in your original output:
How are these values getting sent in? Are the commas in _value there, or being added by InfluxDB? I believe InfluxDB is seeing those values as strings.
Can you go to the system where the data is being scraped and sent into Influx and check your settings there?
grant1
February 5, 2023, 12:46pm
7
I just saw that you are using Grafana. Can you try the transformation there, like this?
and if that works, we can convert to GB using a second Grafana transformation.
grant1
February 5, 2023, 12:51pm
8
Not really a great example, but it should look something like this when done:
(for the Operation, change the + to a / )
Thanks, Grafana worked. I did it with the override section. It automatically changed the values from bytes to GB.
1 Like