Docker 在grafana中设置多个数据源

Docker 在grafana中设置多个数据源,docker,docker-compose,grafana,influxdb,Docker,Docker Compose,Grafana,Influxdb,我能够在为grafana构建docker容器时导入数据源和仪表板。我尝试创建两个单独的datasource.yml文件(例如:datasource1.yml和datasource2.yml)并复制到/etc/grafana/provisioning/datasources中,但得到以下错误 lvl=warn msg="[Deprecated] the datasource provisioning config is outdated. please upgrade" logger=provis

我能够在为grafana构建docker容器时导入数据源和仪表板。我尝试创建两个单独的datasource.yml文件(例如:datasource1.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"
有没有提示我如何实现多个数据源和仪表盘

数据源1.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
数据源:
-access:“代理”#让grafana执行请求
可编辑:true#是否应可编辑
是否为默认值:true#这是否应该是默认的DS
名称:“test1”#数据源的名称
org_id:1#要将此数据源绑定到的组织的id
类型:“influxdb”#数据源的类型
url:'http://:8086'#prom实例的url
数据库:“db1”
版本:1#嗯,版本控制
数据源2.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
数据源:
-access:“代理”#让grafana执行请求
可编辑:true#是否应可编辑
是否为默认值:true#这是否应该是默认的DS
名称:“test2”#数据源的名称
org_id:1#要将此数据源绑定到的组织的id
类型:“influxdb”#数据源的类型
url:'http://:8086'#prom实例的url
数据库:“db2”
版本:1#嗯,版本控制
您可以检查这个

我一直是apiVersion中缺少的第一行:这使 区别


能否提供
datasource1.yml
datasource2.yml
的内容。正如错误所说,每个组织可以有一个默认数据源。添加apiVersion:1解决了我的问题。根据grafana的文档,当我使用isDefault和orgId时,我无法创建两个数据源。我还为仪表板使用了不同的orgId。
# # config file version
apiVersion: 1