Setting up Grafana for HiveMQ Monitoring in Kubernetes
In this guide, we will demonstrate how to configure and deploy the HiveMQ Dashboard in Grafana, empowering you to monitor your HiveMQ instances with precision.
Instructions
To begin, download and rename to
hivemq-dashboard.json. Then create a ConfigMap named "hivemq-dashboard" using the hivemq-dashboard.json file:kubectl create configmap 'hivemq-dashboard' \ --from-file hivemq-dashboard.json \ --namespace hivemq-namespaceAdd the Grafana repository to Helm.:
helm repo add grafana https://grafana.github.io/helm-charts helm repo updateRetrieve the Grafana configuration values and save them to a file named grafana-values.yaml:
helm show values grafana/grafana > grafana-values.yamlEdit the grafana-values.yaml file to incorporate the HiveMQ dashboard into
dashboardsConfigMapsas follows:dashboardsConfigMaps: hivemq-dashboard: "hivemq-dashboard"Grafana will automatically mount the config map "hivemq-dashboard" to the directory /var/lib/grafana/dashboards/hivemq-dashboard within the Grafana container.
Add a Dashboard Provider configuration with the same name as the dashboard ('hivemq-dashboard'). Specify the path as /var/lib/grafana/dashboards/hivemq-dashboard and assign it to the "HiveMQ" folder:
dashboardProviders: dashboardproviders.yaml: apiVersion: 1 providers: - name: 'hivemq-dashboard' orgId: 1 folder: 'HiveMQ' type: file disableDeletion: false editable: true options: path: /var/lib/grafana/dashboards/hivemq-dashboardDeploy Grafana with the customized values:
helm upgrade 'grafana' --install 'grafana/grafana' \ --values 'grafana-values.yaml' \ --namespace hivemq-namespaceUpon successful Grafana installation, retrieve the 'admin' user password by running::
kubectl get secret grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echoFacilitate access to Grafana on your local machine by forwarding the service with this command:
kubectl port-forward svc/grafana 3000:80Open your preferred web browser and navigate to http://localhost:3000. Sign in using the "admin" username and the password obtained in Step 6.
To validate the presence of the HiveMQ dashboard, explore the "HiveMQ" folder located under "Dashboards" within the Grafana interface:
Dashboards in GrafanaHiveMQ Dashboard
You have successfully orchestrated the deployment of the HiveMQ Dashboard in Grafana, providing you with an advanced monitoring solution for your HiveMQ instances.
Tested with versions:
grafana/grafana 6.59.4 10.1.1
prometheus-community/prometheus 24.4.0 v2.47.0
hivemq/hivemq-operator 0.11.25 4.19.0