Search code examples
influxdbgrafana

Create sum of multiple queries with influxdb


I have four singlestat panels which show my used space on different hosts (every host has also different type_instances):

enter image description here

The query for one of this singlestats is the following: enter image description here

Question: Is there a way to create a fifth singlestat panel which sows the sum of the other 4 singlestats ? (The sum of all "storj_value" where type=shared)


Solution

  • The influx query language does not currently support aggregations across metrics (eg, JOINs). It is possible with Kapacitor but that requires that new aggregated values for all the measurements are written to the DB, by writing code to do it, which will need to be queried separately.

    Only option currently is to use an API that does have cross-metric function support, for example Graphite with an InfluxDB storage back-end, InfluxGraph.

    The two APIs are quite different - Influx's is query language based, Graphite is not - and tagged InfluxDB data will need to be configured as a Graphite metric path via templates, see configuration examples.

    After that, Graphite functions that act across series can be used, in particular for the above question, sumSeries.