squeakywheel/grafana

By squeakywheel

Updated over 4 years ago

Image
0

404

Grafana | Ubuntu

About Grafana

Grafana is a feature rich metrics dashboard and graph editor for Cloudwatch, Elasticsearch, Graphite, InfluxDB, OpenTSB, Prometheus, and Hosted Metrics. Read more on the Grafana website.

Tags

  • 7.0.3-focal, 7.0.3, 7.0-focal, 7.0, 7-focal, 7, focal, beta - /!\ this is a beta release
Architectures supported
  • amd64, arm64, ppc64el, s390x

Usage

Docker CLI
$ docker run -d --name grafana -p 30000:3000 -e TZ=UTC squeakywheel/grafana:edge

Access your Grafana instance at localhost:30000.

Parameters

ParameterDescription
-e TZ=UTCTimezone.
-p 30000:3000Expose Grafana on localhost:30000.
-v /path/to/grafana/provisioning/files/:/etc/grafana/provisioning/Pass a directory with files to provision a Grafana datasource and dashboard (see documentation).
-v /path/to/persisted/data:/var/lib/grafanaPersist data with a voulme instead of initializing a new database for each newly launched container.

Debugging

In case you need to debug what it is happening with the container you can run docker logs <name_of_the_container>. For a better experience while checking logs pass -e GF_LOG_MODE="console file" when you run the container. Alternatively, for an interactive shell run:

$ docker exec -it <name_of_the_container> /bin/bash

Deploy with Kubernetes

You can use your favorite Kubernetes distribution; if you don't have one, consider installing MicroK8s.

With microk8s running, enable the dns and storage add-ons:

$ microk8s enable dns storage

Create a configmap for the provisioning configuration files (check the Grafana documentation on how to provision a dashboard):

$ microk8s kubectl create configmap grafana-config --from-file=grafana-datasource=config/datasource.yml --from-file=grafana-dashboard-definition=config/dashboard.yml --from-file=grafana-dashboard=config/system-stats-dashboard.json

Use the sample deployment yaml provided here.

Apply the `grafana-deployment.yml` (click to expand)
# grafana-deployment.yml
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: grafana-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana
  template:
    metadata:
      labels:
        app: grafana
    spec:
      containers:
      - name: grafana
        image: squeakywheel/grafana:edge
        volumeMounts:
        - name: grafana-config-volume
          mountPath: /etc/grafana/provisioning/datasources/datasource.yml
          subPath: datasource.yml
        - name: grafana-config-volume
          mountPath: /etc/grafana/provisioning/dashboards/dashboard.yml
          subPath: dashboard.yml
        - name: grafana-config-volume
          mountPath: /etc/grafana/provisioning/dashboards/system-stats-dashboard.json
          subPath: system-stats-dashboard.json
        ports:
        - containerPort: 3000
          name: grafana
          protocol: TCP
      volumes:
        - name: grafana-config-volume
          configMap:
            name: grafana-config
            items:
            - key: grafana-datasource
              path: datasource.yml
            - key: grafana-dashboard-definition
              path: dashboard.yml
            - key: grafana-dashboard
              path: system-stats-dashboard.json
---
apiVersion: v1
kind: Service
metadata:
  name: grafana-service
spec:
  type: NodePort
  selector:
    app: grafana
  ports:
  - protocol: TCP
    port: 3000
    targetPort: 3000
    nodePort: 30000
    name: grafana
$ microk8s kubectl apply -f grafana-deployment.yml

You will now be able to connect to the Grafana on http://localhost:30000.

Bugs and Features request

If you find a bug in our image or want to request a specific feature file a bug here:

https://bugs.launchpad.net/ubuntu-docker-images/+filebug

In the title of the bug add grafana: <reason>.

Make sure to include:

  • The digest of the image you are using, you can find it using this command replacing <tag> with the one you used to run the image:
$ docker images --no-trunc --quiet squeakywheel/grafana:<tag>
  • Reproduction steps for the deployment
  • If it is a feature request, please provide as much detail as possible

Docker Pull Command

docker pull squeakywheel/grafana