I’m trying to use templates to select a datasource, based on a different template variable.
I have several Sensu servers deployed to different environments. Grafana can talk to each of these and has them configured as datasources (example: Sensu-Dev, Sensu-QA, Sensu-Prod). I have a template for accessing Graphite data from the different environments (Dev, QA, Prod).
I want my dashboard to be able to present data from both, but I want them to stay in sync without needing to set each template value individually. Basically, I want to have a $environment variable, and have that update a hidden template value for the Sensu datasource. If $environment is set to Prod, then the Sensu datasource becomes Sensu-Prod.
I have tried to set this up using a datasource template, with Sensu as my datasource type, and using the $environment variable in the filter in various ways, but it is not working out.
Any suggestions would be appreciated. TIA