Help with dashboard provisioning

Grafana version 5.0.4
Platform: Windows 10

I created a dashboard on my locally running grafana instance, and now want to provide that to another system through provisioning.

I saved my dashboard to a json file.

Created a yaml file in provisioning/dashboards contains the following:
# # config file version
apiVersion: 1

providers:
 - name: 'default'
   orgId: 1
   folder: ''
   type: file
   options:
     path: C:/grafana-5.0.4/dashboards

Placed my dashboard.json file in C:/grafana-5.0.4/dashboards

Run grafana.

My dashboard is created, but it appears it has not mapped the dashboard to the data sources correctly.
Dashboard view displays errors (red triangle in the top left corner of each widget) with:
Datasource named ${DS_STAGE_DEFAULT} was not found.

My datasource does exist, and can be connected to. The datasource on the remote system was created through provisioning (unlike my local system where it was created through the UI).

Beginning of my dashboard.json contains:

"__inputs": [
    {
      "name": "DS_STAGE_DEFAULT",
      "label": "Stage Default",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    },
    {
      "name": "DS_STAGE_HIGH FREQUENCY",
      "label": "Stage High Frequency",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],

Unsure what I’ve done wrong or what to look at from here.

the dashboard json for the dashboard provisioning is not the same json you get when you export a dashboard.
You need to get the json from the api or get it by viewing the dashboard json.
If you export the dashboard it modifies the json and adds placeholders for the used datasources.

1 Like

Updated my json file by going to settings -> view json

I now get the following error log messsage in grafana
t=2018-04-16T21:10:44+0000 lvl=eror msg=“provisioned dashboard json files cannot contain id” logger=provisioning.dashboard type=file name=default

Also tried getting it from the API in case there was something different. Same result.

just edit the json and remove the id. In nightly builds the id just gets ignored but if you are on a release you have to remove it for now.
See https://github.com/grafana/grafana/pull/11379

1 Like

That fixes it. Thanks svenklemm.