Skip to content

Make usage of Grafana Provisioning feature

hwassman edited this page Nov 20, 2023 · 5 revisions

Grafana supports configuration as code through provisioning. Configuration as code is the practice of storing the configuration of your system as a set of configuration files, which can be reused across environments.

At startup, Grafana loads the configuration files from the provisioning directory and provisions the resources listed in the manifests. The provisioning directory assumes the following structure:

provisioning/
  datasources/
    <yaml files>
  dashboards/
    <yaml files>
  notifiers/
    <yaml files>

For more info about Grafana provisioning feature please check the Provision dashboards and data sources tutorial.

Grafana Provisioning example

install grafana-8.2.1-1.x86_64.rpm
wget https://dl.grafana.com/oss/release/grafana-8.2.1-1.x86_64.rpm

It’s possible to manage the connection configuration for multiple IBM Storage Scale clusters (data sources) in Grafana by adding a YAML config file in the provisioning/datasources directory. Follow reading Provision an IBM Storage Scale data source.

Provision an IBM Storage Scale data source

  1. Copy the datasource.yaml file in the provisioning/datasources/ directory of your Grafana instance:

     cd /etc/grafana/provisioning/datasources/
     svn export https://github.com/IBM/ibm-spectrum-scale-bridge-for-grafana/trunk/examples/grafana_provisioning/datasource.yaml
    
  2. Update the datasource.yaml file for the IBM Storage Scale clusters you want to monitor with this Grafana instance. Note: <host-ip> is the ip of the host running the grafana-bridge.

     - name: my_scale_cluster1
       type: opentsdb
       access: proxy
       url: http://<host-ip>:4242
       isDefault: true
       jsonData:
         tsdbResolution: 1
         tsdbVersion: 2.3
       editable: true
    

You might also be interested in reusing the dashboards from the "Example Dashboards bundle" collection. In this case follow reading Provision the "Example Dashboards bundle" collection with folders structure to Grafana.

Provision the "Example Dashboards bundle" collection with folders structure to Grafana

  1. Copy the Example_Dashboards_bundle directory to your Grafana instance host:

     mkdir -p /etc/dashboards
     cd /etc/dashboards
     svn export https://github.com/IBM/ibm-spectrum-scale-bridge-for-grafana/trunk/examples/grafana_dashboards/Example_Dashboards_bundle
    
  2. Copy the dashboards.yaml file in the provisioning/dashboards/ directory of your Grafana instance:

     cd /etc/grafana/provisioning/dashboards/
     svn export https://github.com/IBM/ibm-spectrum-scale-bridge-for-grafana/trunk/examples/grafana_provisioning/dashboards.yaml
    
  3. Update the grafana server config file to set the home dashboard path to the Available_Dashboards.json file

     cat /etc/grafana/grafana.ini
     
     [dashboards]
     # Path to the default home dashboard. If this value is empty, then Grafana uses StaticRootPath + "dashboards/home.json"
     default_home_dashboard_path = /etc/dashboards/Example_Dashboards_bundle/home/Available_Dashboards.json
    

Start the server with systemd

systemctl daemon-reload
systemctl start grafana-server
systemctl enable grafana-server

Verify that Grafana server has started properly

systemctl status grafana-server

● grafana-server.service - Grafana instance
   Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2021-10-21 22:33:37 CEST; 2 days ago
     Docs: http://docs.grafana.org
 Main PID: 27888 (grafana-server)
   CGroup: /system.slice/grafana-server.service
           └─27888 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=rpm cfg:default.paths.logs=/var/log/grafana cfg:default.paths.data=/var/lib/..

You should see the Available Dashboards view as soon as you are logged in to the Grafana web interface.

In the sidebar, hover the cursor over the Configuration (gear) icon and click Data Sources. The provisioned data source configuration for your IBM Storage Scale clusters should appear in the list of data sources.

User Guide

Installation

Configuration

Maintenance

Troubleshooting

Use cases

Designing dashboards

Developer Guide

Clone this wiki locally