小编Mah*_*uda的帖子

无法通过 Grafana API 导入 Grafana 仪表板

我想通过以下导入使用HTTP API的Grafana仪表盘Grafana

Grafana 版本:5.1.3 操作系统 -Windows 10

这是我试过的

curl --user admin:admin "http://localhost:3000/api/dashboards/db" -X POST -H "Content-Type:application/json;charset=UTF-8" --data-binary @c:/Users/Mahadev/Desktop/Dashboard.json
Run Code Online (Sandbox Code Playgroud)

这是我的python代码

import requests

headers = {
'Content-Type': 'application/json;charset=UTF-8',
}

data = open('C:/Users/Mahadev/Desktop/Dashboard.json', 'rb').read()
response = requests.post('http://admin:admin@localhost:3000/api/dashboards/db', headers=headers, data=data)
print (response.text)
Run Code Online (Sandbox Code Playgroud)

两者的输出是:

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

它在我的 json 负载中要求名为仪表板的根属性。任何人都可以建议我如何使用该属性以及我应该提供哪些数据。

如果有人想挖掘更多,这里有一些链接。

https://github.com/grafana/grafana/issues/8193
https://github.com/grafana/grafana/issues/2816
https://github.com/grafana/grafana/issues/8193
https://community.grafana.com/t/how-can-i-import-a-dashboard-from-a-json-file/669
https://github.com/grafana/grafana/issues/273
https://github.com/grafana/grafana/issues/5811
/sf/ask/2797767801/
/sf/ask/2796813281/#39954514
https://www.bountysource.com/issues/44431991-use-api-to-import-json-file-error
https://github.com/grafana/grafana/issues/7029
Run Code Online (Sandbox Code Playgroud)

python grafana

6
推荐指数
1
解决办法
4576
查看次数

标签 统计

grafana ×1

python ×1