Grafana dashboard variables depending a common one

Hello,

I have a common variable which is env and it has equal to dev, staging or prod and I want to have many other variables which depending of env variable.

Exemple host variabe which can be a key value variable with value :slight_smile:
dev : dev_host, staging : staging_host, prod : prod_host

Another variables which are path with value :slight_smile:
dev : dev_path, staging : staging_path, prod : prod_path

I want to have only env variable which can be selected by user at the top of the dashboard and variables host and path which will be used in all my panel in my dashboard with a automatic reload when I change env variable value.

welcome @fmargelidon

are these static values or are they dynamic coming from a datasource

There are static values.

Hi,

If you’re using Infinity Plugin, you can do a query variable and pass something like this in query definition:

the values in CSV are the ones you have statically written by hand, while the Filter expression does the limiting, so that infinity plugin returns only the desired env. You can hide this variable and it will change with env variable.

If you’re not using infinity plugin (nor can you install it), I’m not sure you can do something like that, since Custom variable type doesn’t support any filtering (like regex in Query type).

1 Like

It’s working as expected. Many thanks for the reply :slight_smile: