Reputation: 2818
I have read & write byte counters from an object store going into InfluxDB 0.8.8 (Happy to take a working answer for 0.9. Just waiting for a different storage engine before upgrading)
The data is collected by server, and by device, so for example a data point might have:
timestamp: ...
server: abc1-oss1
disk: disk_id1
read_bytes: a counter
There are a range of IDs in abc\d+ and -oss\d+ such that, for example, abc14-oss5, abc1-oss1, abc8-oss12 are all valid hostnames.
What I'd like to do is provide an overview for all of the different abc\d+-* groups. A viewer would select, say 'abc2' and get the derivative (because it's an ever increasing counter) of the sum of all disks on all hosts that match abc2-*.
While I could put the sum for a specific host in with the initial data insert, I can't do that for a dozen or so hosts that are in abc2-oss*
In grafana I can do a template variable with a regexp to extract the possible abc\d+ values into a variable called $Area, and then:
select sum(value) from "read_bytes" where $timeFilter and hostname =~ /$Area.*/ group by time($interval) order asc
This gives me the per area read sums, but I can't call derivative() on that, as derivative(sum(value)) is invalid in InfluxDB:
select derivative(sum(value)) from ...
"Value cannot be evaluated for type &{sum 10 [oxc21648f220] false}"
I'm assuming this means I need a continuous query in InfluxDB to calculate the sum, and then put the derivative() call on the resultant measurement. How would I do that for a partial column value, so that I'm summing all values for hostname =~ /abc1-.*/
, hostname =~ /abc2-.*/
, and so on?
Upvotes: 1
Views: 7023
Reputation: 1846
DERIVATIVE(SUM(value))
is valid in InfluxDB 0.9, which does still support regex matching in the FROM
clause.
I would recommend reading the differences between 0.8 and 0.9 before migrating, however. They are substantial, and the migration is non-trivial. Wait for the official 0.9.5 release for the best experience.
The new storage engine is in the latest nightly builds if you're ready to dive in.
Upvotes: 1