【发布时间】:2020-01-30 08:04:49
【问题描述】:
在为 grafana 构建 docker 容器时,我能够导入数据源和仪表板。我尝试创建两个单独的 datasource.yml 文件(例如:datasoure1.yml 和 datasource2.yml)并复制到 /etc/grafana/provisioning/datasources 但出现以下错误。
lvl=warn msg="[Deprecated] the datasource provisioning config is outdated. please upgrade" logger=provisioning.datasources filename=/etc/grafana/provisioning/datasources/datasource1.yml
grafana_1_417873282a1 | t=2019-10-01T03:51:49+0000
lvl=warn msg="[Deprecated] the datasource provisioning config is outdated. please upgrade" logger=provisioning.datasources filename=/etc/grafana/provisioning/datasources/datasource2.yml
grafana_1_417873282a1 | t=2019-10-01T03:51:49+0000 lvl=eror msg="Server shutdown" logger=server reason="Service init failed: Datasource provisioning error: datasource.yaml config is invalid. Only one datasource per organization can be marked as default"
任何提示我可以如何实现拥有多个数据源和仪表板?
datasource1.yml
datasources:
- access: 'proxy' # make grafana perform the requests
editable: true # whether it should be editable
is_default: true # whether this should be the default DS
name: 'test1' # name of the datasource
org_id: 1 # id of the organization to tie this datasource to
type: 'influxdb' # type of the data source
url: 'http://<ip-address>:8086' # url of the prom instance
database: 'db1'
version: 1 # well, versioning
datasource2.yml
datasources:
- access: 'proxy' # make grafana perform the requests
editable: true # whether it should be editable
is_default: true # whether this should be the default DS
name: 'test2' # name of the datasource
org_id: 1 # id of the organization to tie this datasource to
type: 'influxdb' # type of the data source
url: 'http://<ip-address>:8086' # url of the prom instance
database: 'db2'
version: 1 # well, versioning
【问题讨论】:
-
能否提供
datasource1.yml和datasource2.yml的内容。正如错误所说,每个组织可以有一个默认数据源。 -
添加 apiVersion: 1 解决了我的问题。
-
根据 grafana 的文档,当我使用 isDefault 和 orgId 时,我无法创建两个数据源。我还为仪表板使用了不同的 orgId。
标签: docker docker-compose grafana influxdb