In Grafana, I want to show how much time has passed since the last record.
In an SQL, it would do something between:
- SELECT now() - _time…
How do I do something similar in Flux?
My query returning data:
from(bucket: "my-bucket") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["_field"] == "Battery") |> filter(fn: (r) => r["device"] == "ZigBee") |> last() |> group() |> bottom(n:100, columns: ["_value"])
This code return last value;
But, I would also like to know how long time since the last data, to check if the device has run out of battery!