/docker-openshift-grafana

Grafana Docker Image for use with Red Hat OpenShift

Primary LanguageShell

Grafana Docker Image for use with Red Hat OpenShift

This repository builds a docker image for use with Red Hat OpenShift taking into account security considerations for running on OpenShift - e.g. not running under the root user.

  1. To build:

    docker build . -t wkulhanek/grafana:latest
    docker push wkulhanek/grafana:latest

    The repository includes an OpenShift Template to run Grafana with persistent storage.

  2. To deploy:

    oc new-project grafana --display-name="Monitoring - Grafana Dashboards"
    oc create -f grafana.yaml
    oc new-app grafana -p VOLUME_CAPACITY=4Gi
  3. Configure a Grafana Data Source

    • Log into Grafana using the Route provided in the Template and using default account admin with password admin (maybe it would be a good idea to change the password after this…​).

    • On the Home Dashboard click Add data source

    • Use the following values for the datasource Config:

      • Name: DS-Prometheus

      • Type: Prometheus

      • Url: http://prometheus:9090 (if your Prometheus service is called prometheus and is in the same project)

      • Access: proxy

    • Click Add

    • Click Save & Test. You should see a message that the data source is working.

  4. Configure a Grafana Dashboard

    • There is an example dashboard JSON file openshift-metrics-dashboard.json available in the repository. This dashboard depends on metrics that are being collected by Prometheus as configured in https://github.com/wkulhanek/openshift-prometheus.

    • In Grafana select the Icon on the top left and then select Dashboards / Import.

    • Either copy/paste the contents of the JSON File (make sure to keep the correct formatting) or click the Upload .json File button selecting the .json file.

    • In the next dialog enter OpenShift as the name and select the previously created datasource DS-Prometheus for Prometheus.

    • Click Import