Installing mqtt-datasource in Grafana

Here we will explore how to add MQTT live data to Grafana
️ This article is deprecated as there is now an easy-to-install version out: https://grafana.com/grafana/plugins/grafana-mqtt-datasource/

This article will stay online as it is a good guideline for adding your own self-built Grafana plugins to the UMH.

To see live data from MQTT, you could use the mqtt-datasource plugin. This tutorial explains how to install it in the Grafana Helm Chart.

Instructions

Go in UMHLens to Helm —> Releases and change the Grafana section in the Helm Chart. In the section extraInitContainers add an additional container:

extraInitContainers: 
 - args:
    - mkdir -p /var/lib/grafana/plugins
      && cd /var/lib/grafana/plugins
      && apk add mage --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
      && apk add git
      && git clone https://github.com/grafana/mqtt-datasource.git
      && cd mqtt-datasource
      && yarn install
      && yarn build
    command:
    - /bin/sh
    - -c
    image: node:lts-alpine3.16
    imagePullPolicy: IfNotPresent
    name: init-mqtt-datasource
    securityContext:
      privileged: true
      runAsUser: 0
    volumeMounts:
    - mountPath: /var/lib/grafana
      name: storage
Last modified February 17, 2023: update (#208) (ea731fc)