Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Grafana on MindSphere CloudFoundry

Tested Environment

$ cf version
cf version 6.38.0+7ddf0aadd.2018-08-07

$ go version
go version go1.10.1 darwin/amd64

$ node --version

$ yarn --version


The following environment variables are recognized by the todo backend:

Variable Description Required
GF_DATABASE_URL Full url of db, including user / password yes
GF_SMTP_PASSWORD Password of smtp server for email notifications yes

CloudFoundry Deployment

Grafana is deployed from its github sources. Since Grafana is a Golang project and we require some custom configuration files to be uploaded when deploying to cloudfoundry, a script is provided that copies the relevant files into the checked out sources.

  1. Copy and adapt the directory sample-conf/, specifically:

    • In defaults.custom.ini, set server.domain and smtp configuration
    • In datasources/prometheus.yaml, set the appropriate url of prometheus
  2. Download the grafana source code. This will save the code to your ${GOPATH} (typically ~/go or ~/.go):

    go get
  3. Checkout the latest tested version (v5.3.4 at the time of writing):

    cd ${GOPATH}/src/
    git checkout v5.3.4
  4. Build the grafana static web interface locally. This is required because we don't want to depend on two buildpacks (go & nodejs). Building the webpack locally before uploading to CloudFoundry allows us to keep the deployment within a single buildpack. It is only required once:

    yarn --cwd "$(go env GOPATH)/src/"
    yarn --cwd "$(go env GOPATH)/src/" --prod run build
  5. Provision the required db service for grafana:

    cf create-service postgresql94 postgresql-xs grafana-postgres
  6. The manifest will bind itself to a LogMe (ELK) service to gather all logs, make sure you have created it in advance:

    cf create-service logme logme-xs devopsadmin-logme
  7. Ensure you are in the right CloudFoundry space and deploy Grafana. The command will also copy the required configuration files to the local grafana source directory before push:

    CF_VARS_FILE="<path>" \
    GF_CONF_DIR="<path>" \

The param CF_VARS_FILE is your CloudFoundry adapted vars file.

The param GF_CONFIG_DIR points to your adapted configuration directory that will be uploaded

Limitations: Alerting Notification Channels

As of grafana v5, auto-provisioning of alerting setup is not possible:

We hope to extend this system to later add support for users, orgs and alerts as well.

In order to configure a Notification Channel:

  • Login into grafana
  • Go to Alerting > Notification channels > Add channel
  • Set values:
    • Name: MindSphere DevOps
    • Type: Email
    • Send on all alerts: checked
    • Email addresses:

Grafana Dashboards Json Export

Import any dashboard into grafana, then save the resulting json found under dashboard -> settings -> view json

IMPORTANT Do not use the dashboard -> share -> save/view json option, this will save a templated wrong json that can't be used for file provisioning

Local Build and Execution

In case you want to build & run locally the grafana distribution:

cd "$(go env GOPATH)/src/"
go run build.go setup
go run build.go build
yarn run build



This project is licensed under the MIT License

You can’t perform that action at this time.