Provisioning Grafana

Config file

Checkout the configuration page for more information on what you can configure in grafana.ini

Config 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

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 --config file parameter.

Using environment variables

All options in the configuration file (listed below) can be overridden using environment variables using the syntax:

GF_<SectionName>_<KeyName>

Where the section name is the text within the brackets. Everything should be upper case and . should be replaced by _. For example, given these configuration settings:

Configuration management tools

Currently we do not provide any scripts/manifests for configuring Grafana. Rather than spending time learning and creating scripts/manifests for each tool, we think our time is better spent making Grafana easier to provision. Therefore, we heavily relay on the expertise of the community.

Datasources

This feature is available from v5.0

It’s possible to manage datasources in Grafana by adding one or more yaml config files in the provisioning/datasources directory. Each config file can contain a list of datasources that will be added or updated during start up. If the datasource already exists, Grafana will update it to match the configuration file. The config file can also contain a list of datasources that should be deleted. That list is called delete_datasources. Grafana will delete datasources listed in delete_datasources before inserting/updating those in the datasource list.

Running multiple Grafana instances.

If you are running multiple instances of Grafana you might run into problems if they have different versions of the datasource.yaml configuration file. The best way to solve this problem is to add a version number to each datasource in the configuration and increase it when you update the config. Grafana will only update datasources with the same or lower version number than specified in the config. That way, old configs cannot overwrite newer configs if they restart at the same time.

Json data

Since not all datasources have the same configuration settings we only have the most common ones as fields. The rest should be stored as a json blob in the json_data field. Here are the most common settings that the core datasources use.

Secure Json data

Secure json data is a map of settings that will be encrypted with secret key from the Grafana config. The purpose of this is only to hide content from the users of the application. This should be used for storing TLS Cert and password that Grafana will append to the request on the server side. All of these settings are optional.

Name

Type

Datasource

Description

tlsCACert

string

All

CA cert for out going requests

tlsClientCert

string

All

TLS Client cert for outgoing requests

tlsClientKey

string

All

TLS Client key for outgoing requests

password

string

Postgre

password

user

string

Postgre

user

Dashboards

It’s possible to manage dashboards in Grafana by adding one or more yaml config files in the provisioning/dashboards directory. Each config file can contain a list of dashboards providers that will load dashboards into Grafana from the local filesystem.

When Grafana starts, it will update/insert all dashboards available in the configured folders. If you modify the file, the dashboard will also be updated. By default Grafana will delete dashboards in the database if the file is removed. You can disable this behavior using the disableDeletion setting.

Note. Provisioning allows you to overwrite existing dashboards which leads to problems if you re-use settings that are supposed to be unique. Be careful not to re-use the same title multiple times within a folder or uid within the same installation as this will cause weird behaviours.