23

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?

Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286

4 Answers4

11

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...

michalrudko
  • 1,432
  • 2
  • 16
  • 30
2

The following trick worked for me with Grafana 8.

As preparation you have to create a datasource variable "DS_PROMETHEUS".

Then inside the dashboard:

  1. Click "Share Dashboard or Panel"
  2. Switch to "Export" Tab
  3. Activate "Export for sharing externally"
  4. Click "View JSON" and copy the json to the clipboard

Then in the same dashboard open the "Dashboard settings"->"JSON Model" and paste the json from above.

Udo
  • 2,300
  • 1
  • 23
  • 27
1

You can specify data source variable for a dashboard:

http://docs.grafana.org/reference/templating/#variable-types

sumek
  • 26,495
  • 13
  • 56
  • 75
0

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

Math666
  • 101