Second imported dashboard overwrites the first imported dashboard with different data sources

I’m trying to use the same type of dashboard for different grafana sources. To do that, I simply import the json code and choose the data source that I’m interested in. The problem is that if the second time I import a dashboard for a different data source, it simply overwrite the dashboard which was initially imported and then I end up only with one dashboard. Any ideas how I can get past this and have as many similar dashboard as I want?


This part of the documentation should help explain the situation:

If the uid is configured in the dashboard json you are trying to import that would lead to the dashboard being overwritten. Also, there can only be one dashboard with the same title in a folder so you would have to change one of them to be able to import the dashboard as a new dashboard.

Good luck.

1 Like

I don’t understand. Am I supposed to do it using the http api and running it from the cli? Can’t I do it using the GUI? I’m really a very cli-oriented type of guy, I really like to type, but for something as basic as copying dashboards and simply using different database sources (yes, was “clever” enough to use different names for the dashboards) I’d have expected a way to do it through the GUI directly.
I don’t have this section in the json i’m trying to import:
“dashboard”: {
“id”: null,
“uid”: null,
“title”: “Production Overview”,
“tags”: [ “templated” ],
“timezone”: “browser”,
“schemaVersion”: 16,
“version”: 0
So I’d have expected grafana to deal with IDs by itself instead of overwriting them…

Is there a uid field in your json and does it have a value (if so, replace it with null)? You should be able to import the dashboard json through the gui but if the uid is set it will use it to find an existing dashboard and overwrite it. It’s a feature to make it possible to update a dashboard.

1 Like

Indeed, it did work after changing the UID. I thought the UID needed to be part of the dashboard block, but it appeared only at the end of the file together with timezone, title and version.

Glad to hear we got it sorted :slightly_smiling_face:

I wouldn’t tell this as a solution, but yes a good workaround. As an end user, I would expect if I export the dashboard and then import with different name, It would keep both dashboard. I consider this a bug.

1 Like

I actually agree. It is completely non-intuitive, even for a specialist. There’s no reason why this shouldn’t be easier. I wonder if anything changed in Grafana 6.