预配数据源
如果您想通过 Grafana 的预配功能来预配您的数据源,请使用以下设置。
基本预配
如果您需要通过文件进行预配,请针对基本用例使用以下设置
- name: <<YOUR DATASOURCE INSTANCE NAME>>
type: yesoreyeram-infinity-datasource
高级预配
如果您需要数据源的高级版本,请使用以下格式
- name: <<YOUR DATASOURCE INSTANCE NAME. Example -- Github>>
type: yesoreyeram-infinity-datasource
basicAuth: true
basicAuthUser: <<YOUR USER NAME. Example -- github_id>>
jsonData:
auth_method: 'basicAuth'
allowedHosts:
- 'https://foo.com/bar'
- 'https://example.com'
oauthPassThru: <<true or false>> -- false by default. Set to true if you want to pass the auth token from grafana
tlsSkipVerify: <<true or false>> -- false by default
tlsAuth: <<true or false>> -- false by default
tlsAuthWithCACert: <<true or false>> -- false by default
serverName: <<server name that matches in certificate for tlsAuthWithCACert>>
timeoutInSeconds: <<60>> -- or whatever the timeout you want set. If not set defaults to 60.
allowDangerousHTTPMethods: false
secureJsonData:
basicAuthPassword: <<YOUR PASSWORD. Example -- MY_Github_PAT_Token>>
tlsCACert: <<Your TLS cert>>
tlsClientCert: <<Your client certificate>>
tlsClientKey: <<Your client key>>
有关更多高级配置,请参考本文档中的 生成预配 yaml 文件 部分
自定义请求头
如果您想预配自定义请求头,可以使用以下语法
jsonData:
httpHeaderName1: <<Header1 Key>>
httpHeaderName2: <<Header2 Key>>
httpHeaderName3: X-API-Token
httpHeaderName4: <<Header4 Key>>
secureJsonData:
httpHeaderValue1: <<Header1 Value>>
httpHeaderValue2: <<Header2 Value>>
httpHeaderValue2: xxxx-1234-xxxx-yyyy-1234
httpHeaderValue4: <<Header4 Value>>
更多示例
有关预配的更多示例,例如 oauth2
等,请使用 Infinity 数据源配置的预配部分。您可以通过手动配置数据源来生成预配文件。
生成预配 yaml 文件
一旦手动配置数据源并验证其工作正常后,您可以直接从数据源配置页面本身生成预配 YAML 文件。请在配置页面底部的 更多 部分中查找 Provisioning Script
按钮。