1

I have a Grafana dashboard which has 3 different global variables for the user to choose from: cloud(aws, azure, gcp), environment(dev, stage, prod), location(eastus2, westus2, westeurope, northeurope, etc..)

The user can choose a specific dashboard with the combination of these three variables.

I want to add a string constant(say, a uuid), which is unique for different combination of these three variables, such that:

aws-dev-eastus2 => b3207989-162c-4be6-a3d0-3a17444cff7d
azure-stage-westeurope => 5340aad8-ea3d-416b-8ab2-1cafd7c301ca
gcp-prod-westus2 => 2f2b3a9c-c179-4b70-b688-36d9f3548bc2
...

I wonder if it is possible to have a constant type variable, in the format of map/dictionary, so that when the three variables "cloud/environment/location" are fix, this variable can return the corresponding uuid.

Any ideas?

Ken Tsoi
  • 1,195
  • 1
  • 17
  • 37
  • You should to provide UI example what do you want to achieve. Only correct question gives you correct answer. Also term "global" is confusing. – Jan Garaj Sep 23 '21 at 14:29

1 Answers1

1

1.) Global variables - No they can't be "global". Grafana has only some builtin variables, which are global - doc: https://grafana.com/docs/grafana/latest/variables/variable-types/global-variables/. User can define only dasbhoard variable (so scope of the variable is only for one particular dashboard, not for whole Grafana instance)

2.) Key => value variable - yes/no, only some SQL (e.g. PotgreSQL, MySQL) datasources support it and also Custom variable supports it (make sure you have Grafana version, with support for that - ). Doc: https://grafana.com/docs/grafana/latest/variables/variable-types/add-custom-variable/#enter-custom-options

Jan Garaj
  • 25,598
  • 3
  • 38
  • 59
  • 1
    I have tried to use `Custom` key/value pair variable, but it will display a drop down list for me to choose from. That was not what I want – Ken Tsoi Sep 23 '21 at 13:17
  • Sorry, the scope I want should be dashboard wide, but not global, I have modified the question. – Ken Tsoi Sep 23 '21 at 13:37