I've got a new datasource I would like an existing dashboard to use.
How can I change it over? Is there a quicker way than exporting / importing the dashboard?
I've got a new datasource I would like an existing dashboard to use.
How can I change it over? Is there a quicker way than exporting / importing the dashboard?
Specifying a variable would not solve all the problems with changing a data source for the existing dashboard - there will be still some metadata pointing to the old one, which will result in failures. The only thing that worked for me was to go to dashboard setting and copy aside the JSON model, careful find+replace and pasting back the model. I know it's pretty lame, but this was the only thing that worked. There seems to be something missing with this feature in Grafana at the moment...
Add __inputs
block at the root of JSON file
{
"__inputs": [
{
"name": "DS_PROMETHEUS_ID",
"label": "Prometheus Data Source",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
...
description: "",
panels:[...]
...
}
then replace all static uid
values with ${DS_PROMETHEUS_ID}
Now while importing the dashboard you will get the option to choose your own data source.
The following trick worked for me with Grafana 8.
As preparation you have to create a datasource variable "DS_PROMETHEUS".
Then inside the dashboard:
Then in the same dashboard open the "Dashboard settings"->"JSON Model" and paste the json from above.
You can specify data source variable for a dashboard:
http://docs.grafana.org/reference/templating/#variable-types
In the JSON Model (dashboard settings), you can just replace all the occurrence of the id of the old source by the id of your new one
© 2022 - 2024 — McMap. All rights reserved.