我在Ubuntu中使用grafana。我想让两件事自动化。在Grafana中,如何从cli设置数据源和加载模板?
1. Setting up Datasource.
2. Load json template to dashboard.
而不是GUI是否有像CLI这样的可用选项?
我在Ubuntu中使用grafana。我想让两件事自动化。在Grafana中,如何从cli设置数据源和加载模板?
1. Setting up Datasource.
2. Load json template to dashboard.
而不是GUI是否有像CLI这样的可用选项?
是的,你可以用Grafana HTTP API自动化这些东西。
从文档采取例如,你可以创建一个新的数据源有:
POST /api/datasources HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"name":"test_datasource",
"type":"graphite",
"url":"http://mydatasource.com",
"access":"proxy",
"basicAuth":false
}
我使用Python,因为它直截了当这样的事情与grafana实现自动化。但是您可以使用任何可以执行http请求的语言。
或者你可以使用wizzy到Grafana实体两个命令自动完成:
wizzy export datasource <datasource_name>
wizzy insert temp-var <temp-var-name>
下面提供了开始wizzy链接:
https://github.com/utkarshcmu/wizzy
https://utkarshcmu.github.io/wizzy-site/home/getting-started/#installation