We have multiple databases running on different cloud environments,Our usecase is based on environment value we want to change datasource dynamically between AWS, AZURE and GCP.
We implemented the environment values to pass to grafana and created the environment variable to identify the cloud but now how can we change the datasource value between clouds ?
ENV variable:
{ "find": "terms", "field": "fields.env" }
For AWS we are using cloudwatch as datasource and for azure we are using azurecloud monitoring.
Adding sample queries to gather metrics from different datasources.
AWS:
{"alias":"","bucketAggs":[{"field":"@timestamp","id":"2","settings":{"interval":"auto"},"type":"date_histogram"}],"datasource":{"type":"cloudwatch","uid":"xxxxxx"},
Azure:
{"subscription":"xxxxxxxxx","queryType":"Azure Monitor","azureMonitor":{"resourceGroup":"xxxxxxxxx","resourceName":"xxxxxxxx","metricDefinition":"Microsoft.DBforMySQL/flexibleServers","timeGrain":"auto","metricName":"cpu_percent","metricNamespace":"Microsoft.DBforMySQL/flexibleServers","aggregation":"Average","dimensionFilters":[],"top":"10"}}