wizzy icon indicating copy to clipboard operation
wizzy copied to clipboard

Templating error after exporting to Grafana 4.3.3

Open snoby opened this issue 6 years ago • 14 comments

Hi, Running Grafana 4.3.3 and I used wizzy to download dashboard 1471 version 1 wizzy download from-gnet dashboard 1471 1 I then did an export of all my dashboards to Grafana: wizzy export dashboards Problem is that I get the error message:

Templating init failed 
Datasource named ${DS_PROMETHEUS} was not found

This happens with all the dashboards I have imported. However when I manually go to the Grafana gui and do the import everything functions correctly. I went back and manually imported 1471 and then did an import on it and did a diff to see what the difference was:

Seems all the templating was done, and this section below was removed:

 {
-  "__inputs": [
-    {
-      "name": "DS_PROMETHEUS",
-      "label": "prometheus",
-      "description": "",
-      "type": "datasource",
-      "pluginId": "prometheus",
-      "pluginName": "Prometheus"
-    }
-  ],

snoby avatar Aug 15 '17 19:08 snoby

Same issue here when trying to create a dashboard from a previously exported dashboard json, with grafana 4.5.2 and wizzy 0.6.0, pretty much making wizzy unusable for me at the moment :(

athal7 avatar Oct 18 '17 20:10 athal7

I will try to get this bug fixed in a day or two!

utkarshcmu avatar Oct 18 '17 20:10 utkarshcmu

This also seems to be affecting grafana 4.6.1

cainejette avatar Nov 10 '17 21:11 cainejette

In the meantime you can import the dashboard from grafana.com directly into grafana (which will give you the opportunity to specify the datasource it should use), then import it into wizzy from there.

DanCech avatar Nov 10 '17 21:11 DanCech

This might not be a wizzy problem at all, actually -- I am not using wizzy but stumbled across this issue debugging the same symptoms. I tried just importing dashboards from grafana's site and hit the same problem.

Replacing all instances of ${DS_PROMETHEUS} in the dashboard's json with just Prometheus directly worked around the issue.

cainejette avatar Nov 10 '17 21:11 cainejette

Just ran into this issue on Grafana v5.0.4 (commit: 7dc36ae) when importing dashboards exported from another environment.

Seems like the "__inputs": [] are removed and I also get the issue of:

Templating init failed 
Datasource named ${DS_PROMETHEUS} was not found

smur89 avatar Apr 04 '18 08:04 smur89

Same here with an InfluxDB datasource : all JSON exported datasources are prefixed with DS, making export/import from one environment to the other fail

phlenoir avatar Apr 17 '18 12:04 phlenoir

Same here with Grafana 4.4.3 and Graphite data source: { "error": { "message": "Datasource named ${DS_LOCAL_GRAPHITE} was not found" } }

asicoe avatar Apr 26 '18 20:04 asicoe

Look in the Grafana official site, http://docs.grafana.org/reference/export_import/ in the last paragraph:

These inputs and their usage in data source properties are automatically added during export in Grafana 3.1. If you run an older version of Grafana and want to share a dashboard on Grafana.com you need to manually add the inputs and templatize the datasource properties like above.

If you want to import a dashboard from Grafana.com into an older version of Grafana then you can either import it as usual and then update the data source option in the metrics tab so that the panel is using the correct data source. Another alternative is to open the json file in a a text editor and update the data source properties to value that matches a name of your data source.

Your json should include this:

{
  "__inputs": [
    {
      "name": "DS_GRAPHITE",
      "label": "graphite",
      "description": "",
      "type": "datasource",
      "pluginId": "graphite",
      "pluginName": "Graphite"
    },
    {
      "name": "VAR_PREFIX",
      "type": "constant",
      "label": "prefix",
      "value": "collectd",
      "description": ""
    }
  ],
}

nirorman avatar Aug 16 '18 11:08 nirorman

@nirorman What about Grafana 5.x.x ?

vlatk0o avatar Sep 03 '18 08:09 vlatk0o

@vlatk0o that's the one I was using too. You have to add the section above but also change the variable like @cainejette mentioned

nirorman avatar Sep 03 '18 09:09 nirorman

@nirorman Thank you about the answer, it works!

vlatk0o avatar Oct 29 '18 12:10 vlatk0o

Same issue in Grafana v5.4.2 (commit: d812109)

Grafana issue https://github.com/grafana/grafana/issues/10786

insider89 avatar Dec 27 '18 11:12 insider89

Replacing $(DS_PROMETHEUS) with "Prometheus" and making the name of datasource to "Prometheus" in datasources.yaml worked for me in helm charts.

dunefro avatar Feb 20 '20 19:02 dunefro