Grafana Provisioning: Automating Dashboards & Data Sources

Master Grafana provisioning for automated, version-controlled deployments. Learn to configure data sources, dashboards, and alerting using files and practical YAML examples for seamless DevOps and SRE workflows.

Grafana Provisioning: Automating Dashboards & Data Sources

Introduction

Grafana provisioning is an essential method for DevOps engineers and Site Reliability Engineers (SREs) to automate the setup and management of dashboards, data sources, alerting, and other resources in Grafana. By leveraging configuration files, teams achieve version control, seamless deployments, and consistent observability environments across development and production.

What Is Grafana Provisioning?

Provisioning in Grafana refers to the process of pushing configuration via YAML, JSON, or TOML files into a Grafana instance. Rather than manually configuring dashboards and data sources through the UI, you define these resources as code, store them in version control, and apply them automatically during deployment or upgrades.
Key benefits include:

  • Automation: Eliminate manual steps and reduce configuration drift.
  • Version Control: Track changes, roll back, and audit configurations.
  • Scalability: Easily replicate setups across multiple environments.
  • Consistency: Ensure every instance adheres to organizational standards.

Provisionable Grafana Resources

Grafana supports provisioning for several resource types:

  • Data sources
  • Dashboards
  • Alerting resources
  • RBAC (role-based access control)
  • Notification channels
  • Plugins (applications)

Note: Plugins and data source binaries must be installed separately and are not provisioned via files.
[4]

How Grafana Provisioning Works

Grafana’s provisioning system reads configuration files from designated directories on startup. These files are structured to define resources, and can be managed via Git or other SCM tools.
The process involves:

  1. Create provisioning files in your repository (YAML, JSON, or TOML format).
  2. Place files in the correct provisioning directory (e.g., /etc/grafana/provisioning/).
  3. Configure grafana.ini to specify permitted paths and enable feature toggles.
    [2][3]
  4. Restart Grafana to apply the new configuration.

Enabling File Provisioning

To set up file provisioning, adjust your grafana.ini or custom.ini as follows:

[feature_toggles]
provisioning = true
kubernetesDashboards = true ; if using k8s dashboards

[paths]
permitted_provisioning_paths = /etc/grafana/provisioning/ | grafana/

This configuration tells Grafana where to look for provisioning files and enables the necessary features.
[2]

Practical Example: Provisioning a Data Source

Below is a sample datasource.yaml file to provision a Prometheus data source:

apiVersion: 1
datasources:
  - name: Prometheus
    type: prometheus
    access: proxy
    url: http://prometheus:9090
    isDefault: true
    editable: false

Place this file under /etc/grafana/provisioning/datasources/.

Practical Example: Provisioning Dashboards

Dashboards can be provisioned using JSON files referenced in a dashboard.yaml configuration:

apiVersion: 1
dashboard:
  - name: Production Overview
    orgId: 1
    folder: "Production"
    type: file
    options:
      path: /etc/grafana/provisioning/dashboards/production.json

Store your dashboard JSON at the specified path. After a Grafana restart, the dashboard appears in the designated folder.
[5]

Version Control and GitOps

Storing provisioning files in a Git repository enables true GitOps workflows. You can:

  • Track changes over time
  • Review and approve updates before deployment
  • Roll back to previous configurations instantly

This approach ensures that production environments stay in sync with source control, reducing errors and simplifying audits.
[4]

Advanced Provisioning: Alerting and RBAC

Alerting resources are provisioned via YAML files, letting you automate alert rules and notification channels. For example:

apiVersion: 1
alerting:
  - name: High CPU Usage
    condition: cpu_usage > 80
    for: 5m
    actions:
      - notify: "On-call Slack"

Role-based access control (RBAC) provisioning is supported in recent Grafana versions, enabling automated user and permission management via configuration.
[4][7]

Best Practices for Grafana Provisioning

  • Separate environments: Use different provisioning directories or files for dev, staging, and prod.
  • Use relative paths: Ensure directory paths in configs match permitted_provisioning_paths.
  • Validate configurations: Test provisioning in a sandbox before deploying to production.
  • Leverage automation: Combine provisioning with CI/CD pipelines for streamlined deployments.

Troubleshooting Provisioning

If provisioning fails, check:

  • File paths: Must begin with configured permitted_provisioning_paths.
  • Syntax errors: YAML and JSON files must be valid and match Grafana’s schema.
  • Feature toggles: Ensure provisioning is enabled in grafana.ini.
  • Permissions: Grafana process must have read access to provisioning files.

Grafana logs will indicate configuration and file errors on startup.[2][4]

Conclusion

Grafana provisioning is the foundation for scalable, reliable, and repeatable observability environments. By defining resources as code, DevOps teams accelerate deployments, enforce standards, and minimize manual intervention. Embrace provisioning to enable true automation and GitOps for monitoring infrastructure.