【问题标题】:Ansible: Manage Grafana dashboardsAnsible:管理 Grafana 仪表板
【发布时间】:2019-09-01 02:29:02
【问题描述】:

我正在尝试将 Grafana 仪表板的导入复制到 Grafana。

我正在使用下一个模块:

- 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"

我在本地机器和远程机器上都有 node_exporter.json。但是当我运行 ansible playbook 时,它会引发下一个错误:

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'}."}

它抛出dashboard not found,但在本地和远程机器上。我是否跳过任何​​需要的配置?

【问题讨论】:

    标签: ansible grafana grafana-api


    【解决方案1】:

    仪表板管理在 grafana 中是一团糟。到目前为止,我发现的最好方法是使用“预置仪表板”(grafana 用于从文件系统中获取仪表板的特殊配置)。

    查看cloudalchemy.grafana 角色 (tasks/dashboards.yml) 了解他们是如何做到的。

    【讨论】:

      猜你喜欢
      • 2021-04-27
      • 2021-03-09
      • 2016-07-02
      • 2014-10-19
      • 1970-01-01
      • 2018-11-23
      • 1970-01-01
      • 2021-01-23
      • 2019-11-14
      相关资源
      最近更新 更多