Search code examples
sslmqttgrafanapemhivemq

How to configure certificates for Grafana MQTT plugin to connect to HiveMQ cloud broker


I'm running Grafana 9.3.6 installed via apt-get on Ubuntu 20.04.5

I have a HiveMQ cloud broker I'm trying to connect to. Previously I succeeded to connect via mosquitto command line tool and mosquittopp C++ interface. These required me to provide a certificate or certificate path.

  • I used the .pem file provided by HiveMQ with the command line tool.
  • I provided the /etc/ssl/certs/ path for the C++ interface (the 1st option did not work out)

Now I'm trying to connect via the Grafana MQTT plugin. I installed it using

grafana-cli plugins install grafana-mqtt-datasource.

When trying to add it in the web gui, I get the following error:

error connecting to MQTT broker: network Error : EOF

I can see some messages going back and forth in Wireshark so I assume the problem is with the certificates.

I tried editing the grafana.ini file without success. It's not completely clear which file/path should I add where and what other options I need to set.

Edit: the grafana.ini file had nothing to do with this.


Solution

  • As @hardillb pointed out, I had to pay attention to the URL scheme. After putting tls:// in front of the broker URL as described in grafana-mqtt-datasource, everything worked.