Simple variable value lookup? (newbie question)

  • What Grafana version and what operating system are you using?
    v7.1.5 on linux

  • What are you trying to achieve?
    I want to provide a variable (dropdown) at the top of my dashboard which has a bunch of custom options in it. When the user selects one of those options I want it to automatically set 4 other variables to hard-coded pre-known values . I could show all the variables to the user and require them to set them all, but it’s way too easy for them to screw them up (as there is very few valid combinations of them, which the user will not generally know). Like, for example…I want the user to just be able to select the “environment”, and it will automatically configure which prometheus datasource has the data for that environment, the cloudwatch region that environment runs in, the load balancer that environment runs behind etc - the user won’t know all those values, they just know they want to look at the “Staging” environment.

  • How are you trying to achieve it?
    My understanding is I have to use chained variable lookups to do this - creating a hidden variable for each value I want to look up, setting its “default value” using the user-configured top level variable value (like “mySetting.$userSelectedOption.value” or whatever). From what I can gather there isn’t really anything built-in to grafana to do this though, and I need to use an external datasource to store my hard-coded values? It seems like overkill to fire up a full external database to store 15 key/values…or is that what I really have to do? It would be nice if I could configure those 15 key/values right in the grafana UI somewhere…it seemed like the “static” datasource (plugin) could maybe do this…but I really couldn’t figure out how to use it, or (more likely) I’m completely misunderstanding what it does (I’m very newbie). It seems to me that this must be a fairly common thing to do, and the fact that I’m having such troubles figuring it out makes me think I’m going down the entirely wrong path. Any advice here is greatly appreciated. Thanks!

  • What happened?
    Nothing really…can’t figure out how to do it :stuck_out_tongue:

1 Like

Hello :wave: and welcome to the forum, @chrisa66d

I would explore these example dashboards using chained variables:

Then I would upgrade to Grafana 8.2.3. If you are new to Grafana then I would highly recommend starting your journey with an 8+ version. :+1:

This topic was automatically closed after 365 days. New replies are no longer allowed.