Installation – Grafana

To render results from the Prometheus timeseries database, an installation of Grafana is highly recommended. The newest version of Grafana is available here: https://grafana.com/get/?plcmt=top-nav&cta=downloads.

A detailed installation documentation for various platforms can be found here:

https://grafana.com/docs/grafana/latest/installation/

Example for a docker-compose based installation

In this example, a Grafana installation is made using a docker-compose file. Only the necessary part of the file for the configuration and installation of Grafana is shown here.

In addition, the following areas are displayed:

  • additional installation at the start time of plugins (panels)

  • specify administration password

  • include directories for provisioning and configuration

# docker-compose.yml
version: '3'  # Version of docker-compose.yml fileformat
services:
  grafana:
    image: grafana/grafana:6.2.2 # specific version of grafana
                                 # use:latest to get the latest
    volumes:
        - ./grafana_data:/var/lib/grafana # contains grafana database, downloaded plugins
        - ./grafana_conf:/etc/grafana     # contains configuration and provisioning
    environment:
        - GF_SECURITY_ADMIN_PASSWORD=MySecretPassword # set admin password (use this only in demo environment)
        - GF_INSTALL_PLUGINS=grafana-clock-panel  # example for an on installation download of a plugin (clock panel)
    depends_on:
        - prometheus  # There should be also a prometheus installation to refer for dependency
    ports:
        - "3000:3000" # Standard Ports for Grafana

See the comments inside the docker-compose file above for short descriptions.

Inside the volume folder “./grafana_conf” the following file structure is present:

dashboard       folder: containing all dashboard templates and JSON file
  Overview.json exported dashboard with overview about other dashboards
provisioning    folder: containing all data about provisioning
  dashboards    folder: contains one configuration file for dashboards
      all.yml   file: configuration file containing location of JSON files for dashboards
  datasources   folder: contains one configuration file for datasources
      all.yml   file: configuration file for datasources

Example dashboard configuration in “all.yml”

# provisioning/dashboards/all.yml
# https://github.com/cirocosta/sample-grafana/blob/master/grafana/provisioning/dashboards/all.yml
- name: 'default'       # name of this dashboard configuration (not dashboard itself)
  org_id: 1             # id of the org to hold the dashboard
  folder: ''            # name of the folder to put the dashboard (http://docs.grafana.org/v5.0/reference/dashboard_folders/)
  type: 'file'          # type of dashboard description (json files)
  options:
    folder: '/etc/grafana/dashboards'       # where the dashboards are