grafana-wizzy / wizzy

Manage & automate Grafana with easy wizzy
https://grafana-wizzy.com
Apache License 2.0
468 stars 60 forks source link

Templating error after exporting to Grafana 4.3.3 #107

Open snoby opened 7 years ago

snoby commented 7 years ago

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"
-    }
-  ],
athal7 commented 6 years ago

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 :(

utkarshcmu commented 6 years ago

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

cainejette commented 6 years ago

This also seems to be affecting grafana 4.6.1

DanCech commented 6 years ago

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.

cainejette commented 6 years ago

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.

smur89 commented 6 years ago

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
phlenoir commented 6 years ago

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

asicoe commented 6 years ago

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

nirorman commented 6 years ago

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": ""
    }
  ],
}
vlatk0o commented 6 years ago

@nirorman What about Grafana 5.x.x ?

nirorman commented 6 years ago

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

vlatk0o commented 5 years ago

@nirorman Thank you about the answer, it works!

insider89 commented 5 years ago

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

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

dunefro commented 4 years ago

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