4

I am trying to copy the import a Grafana dashboard to Grafana.

I am using the next module:

- name: Export dashboard
  grafana_dashboard:
    grafana_url: "http://{{ inventory_hostname }}:3000"
    grafana_user: "user"
    grafana_password: "password"
    org_id: "1"
    state: present
    slug: "node-exporter"
    overwrite: yes
    path: "/tmp/test/node_exporter.json"

I have the node_exporter.json, in the local machine and in the remote machine. But when I run the ansible playbook it throws the next error:

fatal: [172.16.8.231]: FAILED! => {"changed": false, "msg": "error : Unable to create the new dashboard node-exporter-test : 404 - {'body': '{\"message\":\"Dashboard not found\",\"status\":\"not-found\"}', 'status': 404, 'content-length': '54', 'url': 'http://172.16.8.231:3000/api/dashboards/db', 'msg': 'HTTP Error 404: Not Found', 'connection': 'close', 'date': 'Wed, 10 Apr 2019 14:52:58 GMT', 'content-type': 'application/json'}."}

It throws that dashboard not found, but is in local and remote machine. Am I skipping any needed configuration?

Asier Gomez
  • 6,034
  • 18
  • 52
  • 105

1 Answers1

1

Dashboard management is a mess in grafana. The best way I found insofar is to use 'provisioned dashboards' (a special config for grafana to pick up dashboards from filesystem).

Check out cloudalchemy.grafana role (tasks/dashboards.yml) to see how they do it.

George Shuklin
  • 6,952
  • 10
  • 39
  • 80