I ran into a similar issue recently. Chaining doesn’t appear to be supported with custom variables, but I was able to use variable key-value pairs in combination with Regex (I’m using InfluxDB) to get something approximating the required functionality. In your case, I’d define custom variables as region1 : reg1-serv1|reg1-serv2, region2 : reg2-serv1|reg2-serv2, region3 : reg3-serv1|reg3-serv2
Notice the pipe | operators.
Although this will create only a single dropdown menu for “region” (and not another one for “servers” within that region), at least you’ll be able to inject the server names into queries.
With InfluxQL (assuming you’re querying measurements but it’ll work elsewhere; see here): SELECT mean("value") FROM /^(${region:pipe})$/ WHERE $timeFilter GROUP BY time($__interval) fill(null)
Notice that I used the “pipe” option for variable formatting to properly join strings in case of multi-value selection, and ^( and )$ to ensure full string matches. Seems to work with single and multi-value selections.
Query inspector should give you something like this "SELECT mean("value") FROM /^(reg1-serv1|reg1-serv2|reg2-serv1|reg2-serv2|reg3-serv1|reg3-serv2)$/ WHERE time >= now() - 30d and time <= now() GROUP BY time(30m) fill(null)"
when using “all” for “region”. Works similarly when using Flux.
You may need to adjust this to ensure compatibility with your data source.