How can I correctly transform and display strictly increasing values from Influxdb in Grafana?

967 views Asked by At

I have some time series in Influxdb which are collected from Linux /proc filesystem every 10 seconds - for example I/O operations on a hard drive.

These values are by definition strictly increasing, and I want to transform them into I/O operations per second (iops) and display them in Grafana.

This is the closest I've come so far:

SELECT difference(last("value")) / 10 FROM "disk_write" [WHERE <stuff>] GROUP BY time(10s)

I can't find a way to define this query in Grafana with a variable group by time interval.

The problem is, that I can't replace / 10 in the SELECT block with / $interval (which contains 10s), which makes this query very slow if I display a huge time window.

How do I define this correctly?

1

There are 1 answers

0
AussieDan On BEST ANSWER

You'll want to use DERIVATIVE().

Something like this:

SELECT DERIVATIVE("value") FROM "disk_write" [WHERE <stuff>] GROUP BY time(10s)