Create Query Variable To Change InfluxDB Measurement


I’m still new to InfluxDB and Grafana, but I’ve managed to work my way through to the point where I have a fairly usable database and dashboard; but now I’m stuck with a pretty simple problem.

I want to create a variable in Grafana, that lists different measurement options for an InfluxDB query. I’ve managed to create the query variable, and I found this query in the documentation:

import “influxdata/influxdb/schema”
schema.measurements(bucket: “example-bucket”)

This query, however, does not return data. I think this has to do with the structure of my InfluxDB database, as other queries from that same documentation page do return data:

So what I would like to know is:
How do I build a query variable in Grafana, that lists all possible measurement values for the path: bucket - Standort - _field - _measurements

Thank you in advance for any help or suggestions!

hi @jdlaied and welcome to the forum.

You might want to check out this list of public dashboards, all of which feature template variables. There are a few influx examples–that might be a great place to start:

Hey @mattabrams, is the code used to derive the variables used in the examples available?

@cjs226 are you referring to the query-based template variable configurations inside a dashboard?