From f4d43d3ef506517e7cfc915f4c717abd0db6cbc5 Mon Sep 17 00:00:00 2001 From: Jack Baldry Date: Thu, 13 Mar 2025 11:35:16 +0000 Subject: [PATCH] Lint provisioning file (#102005) * Remove reference to deprecated feature flag * Lint provisioning file Signed-off-by: Jack Baldry * Remove regression --------- Signed-off-by: Jack Baldry Co-authored-by: Kristina Durivage --- .../administration/provisioning/index.md | 565 +++++++++--------- 1 file changed, 279 insertions(+), 286 deletions(-) diff --git a/docs/sources/administration/provisioning/index.md b/docs/sources/administration/provisioning/index.md index b7b776a1774..dcec3f915d7 100644 --- a/docs/sources/administration/provisioning/index.md +++ b/docs/sources/administration/provisioning/index.md @@ -24,26 +24,25 @@ Refer to [Configuration](../../setup-grafana/configure-grafana/) for more inform ### Configuration file locations -- Default configuration from `$WORKING_DIR/conf/defaults.ini` -- Custom configuration from `$WORKING_DIR/conf/custom.ini` -- The custom configuration file path can be overridden using the `--config` parameter +Grafana reads its default configuration from `/conf/defaults.ini`. +By default, Grafana reads custom configuration from `/conf/custom.ini`. +You can override the custom configuration path with the `--config` option. {{< admonition type="note" >}} -If you have installed Grafana using the `deb` or `rpm` -packages, then your configuration file is located at -`/etc/grafana/grafana.ini`. This path is specified in the Grafana -`init.d` script using the `--config` file parameter. +The Deb and RPM packages install the configuration file at `/etc/grafana/grafana.ini`. +The Grafana init.d script sets the `--config` option to that path. {{< /admonition >}} -### Environment variables +### Use environment variables -You can use environment variable interpolation in all three provisioning configuration types. -The allowed syntax is either `$ENV_VAR_NAME` or `${ENV_VAR_NAME}`, and it can be used only for values, not for keys or larger parts -of the configurations. If the environment variable value has a `$` (e.g. `Pa$sw0rd`), use the `$ENV_VAR_NAME` syntax to avoid double expansion. -It's not available in the dashboard's definition files, just the dashboard provisioning -configuration. +You can use environment variable lookups in all provisioning configuration. +The syntax for an environment variable is `$ENV_VAR_NAME` or `${ENV_VAR_NAME}`. +If the environment variable value has a `$` in it (for example, `Pa$sw0rd`), use the `$ENV_VAR_NAME` syntax to avoid double expansion. +You can only use environment variables for configuration values and not for keys or bigger parts of the configuration file structure. -Example: +You can use environment variables in dashboard provisioning configuration but not the dashboard definition files themselves. + +The following example looks up the data source URL port, user, and password using environment variables: ```yaml datasources: @@ -54,40 +53,38 @@ datasources: password: $PASSWORD ``` -You can use `$$` if you have a literal `$` in your value and want to avoid interpolation. +To escape a literal `$` in your provisioning file values, use `$$`. ## Configuration management tools -Currently, we don't provide any scripts or manifests for configuring Grafana. -Rather than spending time learning and creating scripts or manifests for each tool, we think our time is better spent making Grafana easier to provision. -Therefore, we heavily rely on the expertise of the community. +The Grafana community maintains libraries for many popular configuration management tools. -| Tool | Project | -| --------- | ------------------------------------------------------------------------------------------------------------------------------- | -| Puppet | [https://forge.puppet.com/puppet/grafana](https://forge.puppet.com/puppet/grafana) | -| Ansible | [https://github.com/grafana/grafana-ansible-collection](https://github.com/grafana/grafana-ansible-collection) | -| Chef | [https://github.com/sous-chefs/chef-grafana](https://github.com/sous-chefs/chef-grafana) | -| Saltstack | [https://github.com/salt-formulas/salt-formula-grafana](https://github.com/salt-formulas/salt-formula-grafana) | -| Jsonnet | [https://github.com/grafana/grafonnet-lib/](https://github.com/grafana/grafonnet-lib/) | -| NixOS | [services.grafana.provision module](https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/monitoring/grafana.nix) | +| Tool | Project | +| --------- | --------------------------------------------------------------------------------------------------------------------------------- | +| Puppet | | +| Ansible | | +| Chef | | +| Saltstack | | +| Jsonnet | ) | +| NixOS | [`services.grafana.provision` module](https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/monitoring/grafana.nix) | ## Data sources You can manage data sources in Grafana by adding YAML configuration files in the [`provisioning/datasources`](../../setup-grafana/configure-grafana/#provisioning) directory. -Each configuration file can contain a list of `datasources` to add or update during startup. +Each configuration file contains a list of data sources, under the `datasources` key, to add or update during startup. If the data source already exists, Grafana reconfigures it to match the provisioned configuration file. -The configuration file can also list data sources to automatically delete, called `deleteDatasources`. +You can also list data sources to automatically delete, using the key `deleteDatasources`. Grafana deletes the data sources listed in `deleteDatasources` _before_ adding or updating those in the `datasources` list. You can configure Grafana to automatically delete provisioned data sources when they're removed from the provisioning file. To do so, add `prune: true` to the root of your data source provisioning file. With this configuration, Grafana also removes the provisioned data sources if you remove the provisioning file entirely. -### Running multiple Grafana instances +### Run multiple Grafana instances If you run multiple instances of Grafana, add a version number to each data source in the configuration and increase it when you update the configuration. -Grafana updates only data sources with the same or lower version number than specified in the configuration. +Grafana only updates data sources with the same or lower version number than the one set in the configuration file. This prevents old configurations from overwriting newer ones if you have different versions of the `datasource.yaml` file that don't define version numbers, and then restart instances at the same time. ### Example data source configuration file @@ -176,99 +173,100 @@ For provisioning examples of specific data sources, refer to that [data source's #### JSON data -Not all data sources have the same configuration settings. Only the most common fields are included in examples. -To provision the rest of a data source's settings, include them as a JSON blob in the `jsonData` field. +Not all data sources have the same configuration settings, only the most common ones are fields in the data source provisioning file. +To provision the rest of a data source's settings, include them as JSON in the `jsonData` field. Common settings in the [built-in core data sources](../../datasources/#built-in-core-data-sources) include: +| Name | Type | Data source | Description | +| ------------------------------- | ------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `tlsAuth` | boolean | _HTTP\*_, MySQL | Enable TLS authentication using client cert configured in secure JSON data | +| `tlsAuthWithCACert` | boolean | _HTTP\*_, MySQL, PostgreSQL | Enable TLS authentication using CA cert | +| `tlsSkipVerify` | boolean | _HTTP\*_, MySQL, PostgreSQL, MSSQL | Controls whether a client verifies the server's certificate chain and host name. | +| `serverName` | string | _HTTP\*_, MSSQL | Optional. Controls the server name used for certificate common name/subject alternative name verification. Defaults to using the data source URL. | +| `timeout` | string | _HTTP\*_ | Request timeout in seconds. Overrides `dataproxy.timeout` option | +| `graphiteVersion` | string | Graphite | Graphite version | +| `timeInterval` | string | Prometheus, Elasticsearch, InfluxDB, MySQL, PostgreSQL and MSSQL | Lowest interval/step value that should be used for this data source. | +| `httpMode` | string | InfluxDB | HTTP Method. 'GET', 'POST', defaults to GET | +| `maxSeries` | number | InfluxDB | Max number of series/tables that Grafana processes | +| `httpMethod` | string | Prometheus | HTTP Method. 'GET', 'POST', defaults to POST | +| `customQueryParameters` | string | Prometheus | Query parameters to add, as a URL-encoded string. | +| `manageAlerts` | boolean | Prometheus and Loki | Manage alerts via Alerting UI | +| `alertmanagerUid` | string | Prometheus and Loki | UID of Alertmanager that manages Alert for this data source. | +| `timeField` | string | Elasticsearch | Which field that should be used as timestamp | +| `interval` | string | Elasticsearch | Index date time format. nil(No Pattern), 'Hourly', 'Daily', 'Weekly', 'Monthly' or 'Yearly' | +| `logMessageField` | string | Elasticsearch | Which field should be used as the log message | +| `logLevelField` | string | Elasticsearch | Which field should be used to indicate the priority of the log message | +| `maxConcurrentShardRequests` | number | Elasticsearch | Maximum number of concurrent shard requests that each sub-search request executes per node | +| `sigV4Auth` | boolean | Elasticsearch and Prometheus | Enable usage of SigV4 | +| `sigV4AuthType` | string | Elasticsearch and Prometheus | SigV4 auth provider. default/credentials/keys | +| `sigV4ExternalId` | string | Elasticsearch and Prometheus | Optional SigV4 External ID | +| `sigV4AssumeRoleArn` | string | Elasticsearch and Prometheus | Optional SigV4 ARN role to assume | +| `sigV4Region` | string | Elasticsearch and Prometheus | SigV4 AWS region | +| `sigV4Profile` | string | Elasticsearch and Prometheus | Optional SigV4 credentials profile | +| `authType` | string | Amazon CloudWatch | Auth provider. default/credentials/keys | +| `externalId` | string | Amazon CloudWatch | Optional External ID | +| `assumeRoleArn` | string | Amazon CloudWatch | Optional ARN role to assume | +| `defaultRegion` | string | Amazon CloudWatch | Optional default AWS region | +| `customMetricsNamespaces` | string | Amazon CloudWatch | Namespaces of Custom Metrics | +| `profile` | string | Amazon CloudWatch | Optional credentials profile | +| `tsdbVersion` | string | OpenTSDB | Version | +| `tsdbResolution` | string | OpenTSDB | Resolution | +| `sslmode` | string | PostgreSQL | SSL mode. 'disable', 'require', 'verify-ca' or 'verify-full' | +| `tlsConfigurationMethod` | string | PostgreSQL | SSL certificate configuration, either by 'file-path' or 'file-content' | +| `sslRootCertFile` | string | PostgreSQL, MSSQL | SSL server root certificate file, must be readable by the Grafana user | +| `sslCertFile` | string | PostgreSQL | SSL client certificate file, must be readable by the Grafana user | +| `sslKeyFile` | string | PostgreSQL | SSL client key file, must be readable by _only_ the Grafana user | +| `encrypt` | string | MSSQL | Determines SSL encryption handling. Options include: `disable` - data sent between client and server is not encrypted; `false` - data sent between client and server is not encrypted beyond the login packet; `true` - data sent between client and server is encrypted. Default is `false`. | +| `postgresVersion` | number | PostgreSQL | Postgres version as a number (903/904/905/906/1000) meaning v9.3, v9.4, ..., v10 | +| `timescaledb` | boolean | PostgreSQL | Enable usage of TimescaleDB extension | +| `maxOpenConns` | number | MySQL, PostgreSQL and MSSQL | Maximum number of open connections to the database (Grafana v5.4+) | +| `maxIdleConns` | number | MySQL, PostgreSQL and MSSQL | Maximum number of connections in the idle connection pool (Grafana v5.4+) | +| `connMaxLifetime` | number | MySQL, PostgreSQL and MSSQL | Maximum amount of time in seconds a connection may be reused (Grafana v5.4+) | +| `keepCookies` | array | _HTTP\*_ | Cookies that needs to be passed along while communicating with data sources | +| `prometheusVersion` | string | Prometheus | The version of the Prometheus data source, such as `2.37.0`, `2.24.0` | +| `prometheusType` | string | Prometheus | Prometheus database type. Options are `Prometheus`, `Cortex`, `Mimir` or`Thanos`. | +| `cacheLevel` | string | Prometheus | Determines the duration of the browser cache. Valid values include: `Low`, `Medium`, `High`, and `None`. | +| `incrementalQuerying` | string | Prometheus | Experimental: Turn on incremental querying to enhance dashboard reload performance with slow data sources | +| `incrementalQueryOverlapWindow` | string | Prometheus | Experimental: Configure incremental query overlap window. Requires a valid duration string, for example, `180s` or `15m` Default value is `10m` (10 minutes). | +| `disableRecordingRules` | boolean | Prometheus | Experimental: Turn off Prometheus recording rules | +| `implementation` | string | Alertmanager | The implementation of the Alertmanager data source, such as `prometheus`, `cortex` or `mimir` | +| `handleGrafanaManagedAlerts` | boolean | Alertmanager | When enabled, Grafana-managed alerts are sent to this Alertmanager | + {{< admonition type="note" >}} Data sources tagged with _HTTP\*_ communicate using the HTTP protocol, which includes all core data source plugins except MySQL, PostgreSQL, and MSSQL. {{< /admonition >}} -| Name | Type | Data source | Description | -| ----------------------------- | ------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| tlsAuth | boolean | _HTTP\*_, MySQL | Enable TLS authentication using client cert configured in secure json data | -| tlsAuthWithCACert | boolean | _HTTP\*_, MySQL, PostgreSQL | Enable TLS authentication using CA cert | -| tlsSkipVerify | boolean | _HTTP\*_, MySQL, PostgreSQL, MSSQL | Controls whether a client verifies the server's certificate chain and host name. | -| serverName | string | _HTTP\*_, MSSQL | Optional. Controls the server name used for certificate common name/subject alternative name verification. Defaults to using the data source URL. | -| timeout | string | _HTTP\*_ | Request timeout in seconds. Overrides dataproxy.timeout option | -| graphiteVersion | string | Graphite | Graphite version | -| timeInterval | string | Prometheus, Elasticsearch, InfluxDB, MySQL, PostgreSQL and MSSQL | Lowest interval/step value that should be used for this data source. | -| httpMode | string | Influxdb | HTTP Method. 'GET', 'POST', defaults to GET | -| maxSeries | number | Influxdb | Max number of series/tables that Grafana processes | -| httpMethod | string | Prometheus | HTTP Method. 'GET', 'POST', defaults to POST | -| customQueryParameters | string | Prometheus | Query parameters to add, as a URL-encoded string. | -| manageAlerts | boolean | Prometheus and Loki | Manage alerts via Alerting UI | -| alertmanagerUid | string | Prometheus and Loki | UID of Alert Manager that manages Alert for this data source. | -| timeField | string | Elasticsearch | Which field that should be used as timestamp | -| interval | string | Elasticsearch | Index date time format. nil(No Pattern), 'Hourly', 'Daily', 'Weekly', 'Monthly' or 'Yearly' | -| logMessageField | string | Elasticsearch | Which field should be used as the log message | -| logLevelField | string | Elasticsearch | Which field should be used to indicate the priority of the log message | -| maxConcurrentShardRequests | number | Elasticsearch | Maximum number of concurrent shard requests that each sub-search request executes per node | -| sigV4Auth | boolean | Elasticsearch and Prometheus | Enable usage of SigV4 | -| sigV4AuthType | string | Elasticsearch and Prometheus | SigV4 auth provider. default/credentials/keys | -| sigV4ExternalId | string | Elasticsearch and Prometheus | Optional SigV4 External ID | -| sigV4AssumeRoleArn | string | Elasticsearch and Prometheus | Optional SigV4 ARN role to assume | -| sigV4Region | string | Elasticsearch and Prometheus | SigV4 AWS region | -| sigV4Profile | string | Elasticsearch and Prometheus | Optional SigV4 credentials profile | -| authType | string | Cloudwatch | Auth provider. default/credentials/keys | -| externalId | string | Cloudwatch | Optional External ID | -| assumeRoleArn | string | Cloudwatch | Optional ARN role to assume | -| defaultRegion | string | Cloudwatch | Optional default AWS region | -| customMetricsNamespaces | string | Cloudwatch | Namespaces of Custom Metrics | -| profile | string | Cloudwatch | Optional credentials profile | -| tsdbVersion | string | OpenTSDB | Version | -| tsdbResolution | string | OpenTSDB | Resolution | -| sslmode | string | PostgreSQL | SSLmode. 'disable', 'require', 'verify-ca' or 'verify-full' | -| tlsConfigurationMethod | string | PostgreSQL | SSL Certificate configuration, either by 'file-path' or 'file-content' | -| sslRootCertFile | string | PostgreSQL, MSSQL | SSL server root certificate file, must be readable by the Grafana user | -| sslCertFile | string | PostgreSQL | SSL client certificate file, must be readable by the Grafana user | -| sslKeyFile | string | PostgreSQL | SSL client key file, must be readable by _only_ the Grafana user | -| encrypt | string | MSSQL | Determines SSL encryption handling. Options include: `disable` - data sent between client and server is not encrypted; `false` - data sent between client and server is not encrypted beyond the login packet; `true` - data sent between client and server is encrypted. Default is `false`. | -| postgresVersion | number | PostgreSQL | Postgres version as a number (903/904/905/906/1000) meaning v9.3, v9.4, ..., v10 | -| timescaledb | boolean | PostgreSQL | Enable usage of TimescaleDB extension | -| maxOpenConns | number | MySQL, PostgreSQL and MSSQL | Maximum number of open connections to the database | -| maxIdleConns | number | MySQL, PostgreSQL and MSSQL | Maximum number of connections in the idle connection pool | -| connMaxLifetime | number | MySQL, PostgreSQL and MSSQL | Maximum amount of time in seconds a connection may be reused | -| keepCookies | array | _HTTP\*_ | Cookies that needs to be passed along while communicating with data sources | -| prometheusVersion | string | Prometheus | The version of the Prometheus data source, such as `2.37.0`, `2.24.0` | -| prometheusType | string | Prometheus | Prometheus database type. Options are `Prometheus`, `Cortex`, `Mimir` or`Thanos`. | -| cacheLevel | string | Prometheus | Determines the duration of the browser cache. Valid values include: `Low`, `Medium`, `High`, and `None`. | -| incrementalQuerying | string | Prometheus | Experimental: Turn on incremental querying to enhance dashboard reload performance with slow data sources | -| incrementalQueryOverlapWindow | string | Prometheus | Experimental: Configure incremental query overlap window. Requires a valid duration string, i.e. `180s` or `15m` Default value is `10m` (10 minutes). | -| disableRecordingRules | boolean | Prometheus | Experimental: Turn off Prometheus recording rules | -| implementation | string | AlertManager | The implementation of the AlertManager data source, such as `prometheus`, `cortex` or `mimir` | -| handleGrafanaManagedAlerts | boolean | AlertManager | When enabled, Grafana-managed alerts are sent to this Alertmanager | - For examples of specific data sources' JSON data, refer to that [data source's documentation](../../datasources/). -#### Secure JSON Data +#### Secure JSON data -Secure JSON data is a map of settings that are encrypted with a [secret key](../../setup-grafana/configure-grafana/#secret_key) from the Grafana configuration. -The encryption hides content from the users of the application. -This should be used for storing the TLS Cert and password that Grafana appends to the request on the server side. +Secure JSON data is a map of settings encrypted with a [secret key](../../setup-grafana/configure-grafana/#secret_key). +The encryption hides the JSON data from the users of Grafana. +You should use secure JSON data to store TLS certificates and passwords for data source HTTP requests. All of these settings are optional. -{{< admonition type="note" >}} -The _HTTP\*_ tag denotes data sources that communicate using the HTTP protocol, including all core data source plugins except MySQL, PostgreSQL, and MS SQL. -{{< /admonition >}} +| Name | Type | Data source | Description | +| ------------------- | ------ | ---------------------------------- | -------------------------------------------------------- | +| `tlsCACert` | string | _HTTP\*_, MySQL, PostgreSQL | CA cert for out going requests | +| `tlsClientCert` | string | _HTTP\*_, MySQL, PostgreSQL | TLS Client cert for outgoing requests | +| `tlsClientKey` | string | _HTTP\*_, MySQL, PostgreSQL | TLS Client key for outgoing requests | +| `password` | string | _HTTP\*_, MySQL, PostgreSQL, MSSQL | password | +| `basicAuthPassword` | string | _HTTP\*_ | password for basic authentication | +| `accessKey` | string | Amazon CloudWatch | Access key for connecting to Amazon CloudWatch | +| `secretKey` | string | Amazon CloudWatch | Secret key for connecting to Amazon CloudWatch | +| `sigV4AccessKey` | string | Elasticsearch and Prometheus | SigV4 access key. Required when using keys auth provider | +| `sigV4SecretKey` | string | Elasticsearch and Prometheus | SigV4 secret key. Required when using keys auth provider | -| Name | Type | Data source | Description | -| ----------------- | ------ | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| tlsCACert | string | _HTTP\*_, MySQL, PostgreSQL | CA cert for out going requests. You can point directly to your stored cert by using an environment variable following the `$__file{path/to/ca}` format. | -| tlsClientCert | string | _HTTP\*_, MySQL, PostgreSQL | TLS Client cert for outgoing requests. You can point directly to your stored cert by using an environment variable following the `$__file{path/to/cert}` format. | -| tlsClientKey | string | _HTTP\*_, MySQL, PostgreSQL | TLS Client key for outgoing requests. You can point directly to your stored key by using an environment variable following the `$__file{path/to/key}` format. | -| password | string | _HTTP\*_, MySQL, PostgreSQL, MSSQL | password | -| basicAuthPassword | string | _HTTP\*_ | password for basic authentication | -| accessKey | string | Cloudwatch | Access key for connecting to Cloudwatch | -| secretKey | string | Cloudwatch | Secret key for connecting to Cloudwatch | -| sigV4AccessKey | string | Elasticsearch and Prometheus | SigV4 access key. Required when using keys auth provider | -| sigV4SecretKey | string | Elasticsearch and Prometheus | SigV4 secret key. Required when using keys auth provider | +{{< admonition type="note" >}} +The _HTTP\*_ tag denotes data sources that communicate using the HTTP protocol, including all core data source plugins except MySQL, PostgreSQL, and MSSQL. +{{< /admonition >}} #### Custom HTTP headers for data sources -Data sources managed with provisioning can be configured to add HTTP headers to all requests. +You can add HTTP headers to all requests sent to data sources managed by Grafana provisioning Configure the header name in the `jsonData` field and the header value in `secureJsonData`. +The following example sets the `HeaderName` header to have the value `HeaderValue` and the `Authorization` header to have the value `Bearer XXXXXXXXX`: ```yaml apiVersion: 1 @@ -286,12 +284,12 @@ datasources: ## Plugins You can manage plugin applications in Grafana by adding one or more YAML configuration files in the [`provisioning/plugins`](../../setup-grafana/configure-grafana/#provisioning) directory. -Each configuration file can contain a list of `apps` that update during start up. -Grafana updates each app to match the configuration file. +Each configuration file contains a list of `apps` that Grafana configures during start up. +Grafana configures each app to use the configuration in the file. {{< admonition type="note" >}} This feature enables you to provision plugin configurations, not the plugins themselves. -The plugins must already be installed on the Grafana instance. +You must have already installed the plugin to use plugin configuration provisioning. {{< /admonition >}} ### Example plugin configuration file @@ -321,9 +319,9 @@ apps: ## Dashboards You can manage dashboards in Grafana by adding one or more YAML configuration files in the [`provisioning/dashboards`](../../setup-grafana/configure-grafana/#dashboards) directory. -Each configuration file can contain a list of `dashboards providers` that load dashboards into Grafana from the local filesystem. +Each configuration file contains a list of `providers` that Grafana uses to load dashboards from the local filesystem. -The dashboard provider configuration file looks somewhat like this: +### Example dashboard configuration file ```yaml apiVersion: 1 @@ -352,53 +350,55 @@ providers: foldersFromFilesStructure: true ``` -When Grafana starts, it updates and inserts all dashboards available in the configured path. -Then later on, Grafana polls that path every **updateIntervalSeconds**, looks for updated JSON files, and updates and inserts those into the database. - -> **Note:** Dashboards are provisioned to the root level if the `folder` option is missing or empty. - -#### Making changes to a provisioned dashboard - -While you can change a provisioned dashboard in the Grafana UI, those changes can't be saved back to the provisioning source. -If `allowUiUpdates` is set to `true` and you make changes to a provisioned dashboard, you can `Save` the dashboard, then changes persist to the Grafana database. +When Grafana starts, it updates or creates all dashboards found in the configured path. +It later polls that path every `updateIntervalSeconds` for updates to the dashboard files and updates its database. {{< admonition type="note" >}} -If a provisioned dashboard is saved from the UI and then later updated from the source, the dashboard stored in the database will always be overwritten. The `version` property in the JSON file won't affect this, even if it's lower than the version of the existing dashboard. - -If a provisioned dashboard is saved from the UI and the source is removed, the dashboard stored in the database is deleted unless the configuration option `disableDeletion` is set to `true`. +Grafana installs dashboards at the root level if you don't set the `folder` field. {{< /admonition >}} -If `allowUiUpdates` is configured to `false`, you are not able to make changes to a provisioned dashboard. When you click `Save`, Grafana brings up a _Cannot save provisioned dashboard_ dialog. The screenshot below illustrates this behavior. +#### Make changes to a provisioned dashboard -Grafana offers options to export the JSON definition of a dashboard. Either `Copy JSON to Clipboard` or `Save JSON to file` can help you synchronize your dashboard changes back to the provisioning source. +You can make changes to a provisioned dashboard in the Grafana UI but its not possible to automatically save the changes back to the provisioning source. +If `allowUiUpdates` is set to `true` and you make changes to a provisioned dashboard, when you save the dashboard, Grafana persists the changes to its database. -{{< admonition type="note" >}} -The JSON definition in the input field when using `Copy JSON to Clipboard` or `Save JSON to file` has the `id` field automatically removed to aid the provisioning workflow. +{{< admonition type="caution" >}} +If you save a provisioned dashboard in the UI and then later update the provisioning source, Grafana always overwrites the database dashboard with the one from the provisioning file. +Grafana ignores the `version` property in the JSON file, even if it's lower than the dashboard in the database. {{< /admonition >}} +{{< admonition type="caution" >}} +If you save a provisioned dashboard in the UI and remove the provisioning source, Grafana deletes the dashboard in the database unless you have set the option `disableDeletion` to `true`. +{{< /admonition >}} + +If you set `allowUiUpdates` to `false`, you can't save changes to a provisioned dashboard. +When you try to save changes to a provisioned dashboard, Grafana brings up a _Cannot save provisioned dashboard_ dialog box. + +Grafana offers options to export the JSON definition of a dashboard. +Use either **Copy JSON to Clipboard** or **Save JSON to file** to sync your dashboard changes back to the provisioning source. +Grafana removes the `id` field from the dashboard JSON to help the provisioning workflow. + +The following screenshot illustrates this behavior. + {{< figure src="/static/img/docs/v51/provisioning_cannot_save_dashboard.png" max-width="500px" class="docs-image--no-shadow" >}} ### Reusable dashboard URLs -If the dashboard in the JSON file contains an [UID](../../dashboards/build-dashboards/view-dashboard-json-model/), Grafana forces insert/update on that UID. -This allows you to migrate dashboards between Grafana instances and provisioning Grafana from configuration without breaking the URLs given because the new dashboard URL uses the UID as identifier. -When Grafana starts, it updates and inserts all dashboards available in the configured folders. -If you modify the file, then the dashboard is also updated. -By default, Grafana deletes dashboards in the database if the file is removed. -You can disable this behavior using the `disableDeletion` setting. +If the dashboard in the JSON file contains an [UID](../../dashboards/build-dashboards/view-dashboard-json-model/), Grafana updates that the dashboard with that UID in the database. +This lets you migrate dashboards between Grafana instances and keep consistent dashboard URLs. +When Grafana starts, it creates or updates all dashboards available in the configured folders. -{{< admonition type="note" >}} -Provisioning allows you to overwrite existing dashboards -which leads to problems if you reuse settings that are supposed to be unique. -Be careful not to reuse the same `title` multiple times within a folder -or `uid` within the same installation as this causes weird behaviors. +{{< admonition type="caution" >}} +You can overwrite existing dashboards with provisioning. + +Be careful not to reuse the same `title` multiple times within a folder or `uid` within the same Grafana instance to avoid inconsistent behavior. {{< /admonition >}} ### Provision folders structure from filesystem to Grafana -If you already store your dashboards using folders in a git repo or on a filesystem, and also you want to have the same folder names in the Grafana menu, you can use `foldersFromFilesStructure` option. +If you already store your dashboards using folders in a Git repository or on a filesystem, and want to have the same folder names in the Grafana menu, use `foldersFromFilesStructure` option. -For example, to replicate these dashboards structure from the filesystem to Grafana, +For example, to replicate the following dashboards structure from the filesystem to Grafana: ``` /etc/dashboards @@ -410,7 +410,7 @@ For example, to replicate these dashboards structure from the filesystem to Graf └── /resources_dashboard.json ``` -You need to specify just this short provision configuration file. +use the following provisioning configuration file: ```yaml apiVersion: 1 @@ -424,14 +424,14 @@ providers: foldersFromFilesStructure: true ``` -In this example, `server` and `application` become new folders in the Grafana menu. +Grafana creates the `server` and `application` folders in the UI. -{{< admonition type="note" >}} -The `folder` and `folderUid` options should be empty or missing to make `foldersFromFilesStructure` work. +To use `foldersFromFilesStructure`, you must unset the `folder` and `folderUid` options. To provision dashboards to the root level, store them in the root of your `path`. -You can't create nested folders structures, where you have folders within folders. +{{< admonition type="note" >}} +This feature doesn't let you create nested folder structures, where you have folders within folders. {{< /admonition >}} ## Alerting @@ -440,212 +440,205 @@ For information on provisioning Grafana Alerting, refer to [Provision Grafana Al ### Supported settings -The following sections detail the supported settings and secure settings for each alert notification type. Secure settings are stored encrypted in the database and you add them to `secure_settings` in the YAML file instead of `settings`. +The following sections detail the supported settings and secure settings for each alert notification type. +In the provisioning YAML use `settings` for settings and `secure_settings` for secure settings. +Grafana encrypts secure settings in the database. #### Alert notification `pushover` -| Name | Secure setting | -| ---------- | -------------- | -| apiToken | yes | -| userKey | yes | -| device | | -| priority | | -| okPriority | | -| retry | | -| expire | | -| sound | | -| okSound | | +| Name | Secure setting | +| ------------ | -------------- | +| `apiToken` | yes | +| `userKey` | yes | +| `device` | | +| `priority` | | +| `okPriority` | | +| `retry` | | +| `expire` | | +| `sound` | | +| `okSound` | | #### Alert notification `discord` -| Name | Secure setting | -| -------------------- | -------------- | -| url | yes | -| avatar_url | | -| content | | -| use_discord_username | | +| Name | Secure setting | +| ---------------------- | -------------- | +| `url` | yes | +| `avatar_url` | | +| `content` | | +| `use_discord_username` | | #### Alert notification `slack` -| Name | Secure setting | -| -------------- | -------------- | -| url | yes | -| recipient | | -| username | | -| icon_emoji | | -| icon_url | | -| uploadImage | | -| mentionUsers | | -| mentionGroups | | -| mentionChannel | | -| token | yes | -| color | | +| Name | Secure setting | +| ---------------- | -------------- | +| `url` | yes | +| `recipient` | | +| `username` | | +| `icon_emoji` | | +| `icon_url` | | +| `uploadImage` | | +| `mentionUsers` | | +| `mentionGroups` | | +| `mentionChannel` | | +| `token` | yes | +| `color` | | #### Alert notification `victorops` -| Name | -| ----------- | -| url | -| autoResolve | +| Name | +| ------------- | +| `url` | +| `autoResolve` | #### Alert notification `kafka` -| Name | -| -------------- | -| kafkaRestProxy | -| kafkaTopic | +| Name | +| ---------------- | +| `kafkaRestProxy` | +| `kafkaTopic` | #### Alert notification `LINE` -| Name | Secure setting | -| ----- | -------------- | -| token | yes | +| Name | Secure setting | +| ------- | -------------- | +| `token` | yes | #### Alert notification `MQTT` -| Name | Secure setting | -| ------------- | -------------- | -| brokerUrl | | -| clientId | | -| topic | | -| messageFormat | | -| username | | -| password | yes | -| retain | | -| qos | | -| tlsConfig | | +| Name | Secure setting | +| --------------- | -------------- | +| `brokerUrl` | | +| `clientId` | | +| `topic` | | +| `messageFormat` | | +| `username` | | +| `password` | yes | +| `retain` | | +| `qos` | | +| `tlsConfig` | | -##### TLS config +##### TLS configuration -| Name | Secure setting | -| ------------------ | -------------- | -| insecureSkipVerify | | -| clientCertificate | yes | -| clientKey | yes | -| caCertificate | yes | +| Name | Secure setting | +| -------------------- | -------------- | +| `insecureSkipVerify` | | +| `clientCertificate` | yes | +| `clientKey` | yes | +| `caCertificate` | yes | #### Alert notification `pagerduty` -| Name | Secure setting | -| -------------- | -------------- | -| integrationKey | yes | -| autoResolve | | +| Name | Secure setting | +| ---------------- | -------------- | +| `integrationKey` | yes | +| `autoResolve` | | #### Alert notification `sensu` -| Name | Secure setting | -| -------- | -------------- | -| url | | -| source | | -| handler | | -| username | | -| password | yes | +| Name | Secure setting | +| ---------- | -------------- | +| `url` | | +| `source` | | +| `handler` | | +| `username` | | +| `password` | yes | #### Alert notification `sensugo` -| Name | Secure setting | -| --------- | -------------- | -| url | | -| apikey | yes | -| entity | | -| check | | -| handler | | -| namespace | | +| Name | Secure setting | +| ----------- | -------------- | +| `url` | | +| `apikey` | yes | +| `entity` | | +| `check` | | +| `handler` | | +| `namespace` | | #### Alert notification `prometheus-alertmanager` -| Name | Secure setting | -| ----------------- | -------------- | -| url | | -| basicAuthUser | | -| basicAuthPassword | yes | +| Name | Secure setting | +| ------------------- | -------------- | +| `url` | | +| `basicAuthUser` | | +| `basicAuthPassword` | yes | #### Alert notification `teams` -| Name | -| ---- | -| url | +| Name | Secure setting | +| ----- | -------------- | +| `url` | | #### Alert notification `dingding` -| Name | -| ---- | -| url | +| Name | Secure setting | +| ----- | -------------- | +| `url` | | #### Alert notification `email` -| Name | -| ----------- | -| singleEmail | -| addresses | +| Name | Secure setting | +| ------------- | -------------- | +| `singleEmail` | | +| `addresses` | | #### Alert notification `hipchat` -| Name | -| ------ | -| url | -| apikey | -| roomid | +| Name | Secure setting | +| -------- | -------------- | +| `url` | | +| `apikey` | | +| `roomid` | | #### Alert notification `opsgenie` -| Name | Secure setting | -| ---------------- | -------------- | -| apiKey | yes | -| apiUrl | | -| autoClose | | -| overridePriority | | -| sendTagsAs | | +| Name | Secure setting | +| ------------------ | -------------- | +| `apiKey` | yes | +| `apiUrl` | | +| `autoClose` | | +| `overridePriority` | | +| `sendTagsAs` | | #### Alert notification `telegram` -| Name | Secure setting | -| ----------- | -------------- | -| bottoken | yes | -| chatid | | -| uploadImage | | +| Name | Secure setting | +| ------------- | -------------- | +| `bottoken` | yes | +| `chatid` | | +| `uploadImage` | | #### Alert notification `threema` -| Name | Secure setting | -| ------------ | -------------- | -| gateway_id | | -| recipient_id | | -| api_secret | yes | +| Name | Secure setting | +| -------------- | -------------- | +| `gateway_id` | | +| `recipient_id` | | +| `api_secret` | yes | #### Alert notification `webhook` -| Name | Secure setting | -| ----------- | -------------- | -| url | | -| http_method | | -| username | | -| password | yes | -| tls_config | | - -##### TLS config - -| Name | Secure setting | -| ------------------ | -------------- | -| insecureSkipVerify | | -| clientCertificate | yes | -| clientKey | yes | -| caCertificate | yes | +| Name | Secure setting | +| ------------ | -------------- | +| `url` | | +| `httpMethod` | | +| `username` | | +| `password` | yes | +| `tls_config` | | #### Alert notification `googlechat` -| Name | -| ---- | -| url | +| Name | Secure setting | +| ----- | -------------- | +| `url` | | #### Alert notification `Cisco Webex Teams` -| Name | Secure setting | -| --------- | -------------- | -| message | | -| room_id | | -| api_url | | -| bot_token | yes | +| Name | Secure setting | +| ----------- | -------------- | +| `message` | | +| `room_id` | | +| `api_url` | | +| `bot_token` | yes | ## Grafana Enterprise