2

I am quite new to influxdb. I am submitting collectd metrics to it using the graphite writer

For disk statistics, I'd like to do a percentage transformation, and show that on a grafana dashboard.

disk.used / (disk.used + disk.free)

I was fiddling around with something like (which is obviously not working):

Select first(disk.used / (disk.used + disk.free)) from "server.test_server.disk.used" as used left join "server.test_server.disk.free" as free where ....

What is the query that I can use? Is it possible to do such transformations with influxdb? This is soo easy with graphite :(

Update: Using grafana 2.1 and influxdb 0.9

Ákos Vandra-Meyer
  • 1,890
  • 1
  • 23
  • 40

2 Answers2

1

Your schema is not optimal for InfluxDB 0.9. Rather than a few measurements with many child series each, you have many measurements with only a few series each.

There are no JOINs in InfluxDB 0.9, but all series under the same measurement are automatically merged unless filtered by tags. See https://docs.influxdata.com/influxdb/v0.9/query_language/data_exploration/ and https://docs.influxdata.com/influxdb/v0.9/concepts/08_vs_09/#joins for more.

To make the best use of InfluxDB 0.9 you should encode your metadata "test_server" in tags, and your metrics as individual fields. See also Obtaining a total of two series of data from InfluxDB in Grafana

Community
  • 1
  • 1
beckettsean
  • 1,826
  • 11
  • 7
0

Yes it's possible, but can you describe the whole schema and the resulting data that you would like to have? Do a:

select * from "server.test_server.disk"

and give us the output. Or do you have it in two separate tables named server.test_server.disk.free and server.test_server.disk.used? In that case, a preferred way would be to use this kind of a table server.test_server.disk which would contain both metrics (both "used" and "free"). And then you would be able to do something like this:

select first(used / (used + free)) from "server.test_server.disk" 
tkit
  • 8,082
  • 6
  • 40
  • 71