小编Vin*_*ent的帖子

使用api创建grafana仪表板

我正在尝试使用grafana的api从模板创建grafana仪表板.我现在使用grafana v2.0.2.

我有一个api密钥,我可以使用curl获得仪表板,但我无法创建仪表板.

当我执行以下请求时:curl -i -H "Authorization: Bearer eyJrIobfuscatedlkIjoxfQ==" http://localhost:3000/api/dashboards/db/webserver2 然后我将json返回到dasboard.

当我尝试创建我在api示例中找到的最简单的仪表板时,它不起作用:curl -i -H "Authorization: Bearer eyJrIobfuscatedlkIjoxfQ==" -d /tmp/simpledash http://localhost:3000/api/dashboards/dbwhere /tmp/simpledash contains:

{
  "dashboard": {
    "id": null,
    "title": "Production Overview",
    "tags": [ "templated" ],
    "timezone": "browser",
    "rows": [
      {
      }
    ]
    "schemaVersion": 6,
    "version": 0
  },
  "overwrite": false
 }
Run Code Online (Sandbox Code Playgroud)

我收到以下回复:

HTTP/1.1 422 status code 422
Content-Type: application/json; charset=utf-8
Date: Wed, 01 Jul 2015 16:16:48 GMT
Content-Length: 84

[{"fieldNames":   ["Dashboard"],"classification":"RequiredError","message":"Required"}]
Run Code Online (Sandbox Code Playgroud)

我尝试了json的一些变体,但我总是得到那个响应,在互联网上我找不到一个有效的例子.有人为我做过一个有效的例子吗?我喜欢这个工作,所以我可以从ansible创建仪表板.

谢谢!

influxdb grafana

5
推荐指数
2
解决办法
1万
查看次数

标签 统计

grafana ×1

influxdb ×1