[Linux-aus] Any Grafana / Influxdb gurus out there?

Adam Nielsen a.nielsen at shikadi.net
Fri Oct 6 17:23:33 AEDT 2023


> However, in Grafana I'm graphing the energy measurements from
> InfluxDB that are supplied from three current clamps. What I've been
> trying to get sorted out in my head is how I graph a calculated
> datapoint on my graph. One on the energy readings is for the main
> circuit and the other two monitor sub-circuits.

I'm using Grafana quite a bit in my day job, but with TimescaleDB
(PostgreSQL) behind it instead of InfluxDB.

Generally I've found with Grafana that for anything beyond the basics
you're better off switching the panel into text query mode and writing
the SQL or equivalent yourself.

This way you can put calculations into the query to subtract one data
source from another, however depending on your data structure you can
run into difficulties if the timestamps don't line up exactly.  It can
become quite complicated to get it exactly right depending on the
underlying database schema.

With TimescaleDB you can use a function called TIME_BUCKET which will
shift your timestamps (and interpolate the data) so that even if your
readings are taken a few seconds or minutes early or late, you'll end
up with values all at the same exact timestamp that makes it easier to
do the kind of addition or subtraction that you describe.

Presumably InfluxDB can do the same thing but unfortunately I haven't
used it enough to be able to offer any advice there.  I'd look into the
Influx query language to see if you can write a statement there that
performs the calculations you are after.

Cheers,
Adam.


More information about the linux-aus mailing list