Skip to content

Latest commit

 

History

History
73 lines (54 loc) · 3.61 KB

README.md

File metadata and controls

73 lines (54 loc) · 3.61 KB

grafana-init Dockerfile

This image runs a script to initialize a Grafana instance with a set of default resources, like a datasource and JSON dashboards. For more information on the Monasca project, see the wiki.

Sources: grafana-init · Dockerfile · monasca-docker

Tags

Images in this repository are tagged as follows:

  • latest: refers to the latest stable point release, e.g. 1.6.0
  • 1.0.0, 1.0, 1: standard semver tags

Usage

This image requires a running Grafana instance. The monasca/grafana image is recommended for use with Monasca, but any recent Grafana server should work (albeit with some minor modifications).

To use with defaults, run:

docker run --link grafana monasca/grafana-init:latest

The image will connect to a Grafana server at the default address (http://grafana:3000/), create a Monasca datasource, and import several default dashboards.

Note that this script will not run successfully on a Grafana instance that has already been initialized.

Configuration

Variable Default Description
LOG_LEVEL INFO Logging level, e.g. DEBUG
GRAFANA_URL http://grafana:3000 Location of Grafana server
GRAFANA_USERNAME mini-mon Agent Keystone username
GRAFANA_PASSWORD password Agent Keystone password
GRAFANA_USERS '[{"user": GRAFANA_USERNAME, "password": GRAFANA_PASSWORD, "email": ""}]' Agent Keystone users. Default datasource and dashboard are created for multiple users if this variable is set as proper JSON format. e.g. '[{"user": "mini-mon", "password": "password", "email": ""}, {"user": "username", "password": "password", "email": ""}]'. Default value is overwritten by GRAFANA_USERNAME and GRAFANA_PASSWORD. NOTE: Set this variable in String type
DATASOURCE_TYPE monasca Agent Keystone user domain
DATASOURCE_URL http://monasca:8070/ Agent Keystone project name
DATASOURCE_ACCESS_MODE proxy Grafana access mode string
DATASOURCE_AUTH Keystone Grafana authentication option (Keystone, Horizon, Token)
DATASOURCE_AUTH_TOKEN `` Keystone token for authentication (for use when DATASOURCE_AUTH is set to Token)
DASHBOARDS_DIR /dashboards.d Directory to scan for .json dashboards

Note that the only datasource type supported at the moment is monasca. Other datasources should be simple to implement as needed by adding logic to create_datasource_payload() in grafana.py.

Custom Dashboards

This image comes with a default set of Monasca-specific dashboards, but these can be overridden. To do so, mount a directory containing .json files to /dashboards.d (path configurable via DASHBOARDS_DIR).

The directory will be scanned and each .json file will be imported. Files are sorted before importing, so filenames can be prefixed, e.g. 01-first.json, 99-last.json, to help ensure proper ordering in the Grafana UI,