grafana / mqtt-datasource

MQTT Datasource for Grafana allows streaming data from any MQTT broker running either locally or remotely.
Apache License 2.0
168 stars 49 forks source link

Problem to receive MQTT notifications #66

Open OlivierGre opened 1 year ago

OlivierGre commented 1 year ago

I'm trying to use Grafana to display MQTT data coming from a MQTT Server on "The Things Network", a LoRaWAN network.

I have added the MQTT plugin and launched the dashboard. In the setting gear (on left side), I have clicked on Data sources and selected MQTT. I have provided the credentials. When I click on "Save & Test", Grafana says that the MQTT connection is OK.

I have then created a new Dashboard and added a new panel. In the Data Source I have selected MQTT and I have filled the "Topic". For the moment, I don't succeed to get data displayed. In the query inspector, I can see that the response has the status 200 so it was OK but it only contains empty data.

I don't think that the problem is on the MQTT server side (on The Things Network) because I have installed a MQTT Client on my mobile (MyMQTT) and configured it with the same Topic. It does receive the MQTT notifications so the MQTT server is working. The problem seems on Grafana side.

Would you have some advices?

Thank you

alfonsol commented 1 year ago

I am having this same exact issue. There is nothing in the Grafana logs indicating an error either. I have also confirmed with 2 other mqtt clients that the messages are coming through from the broker just fine.

Anyone else?

chefscho commented 1 year ago

Hi,

same here. No obvious reason for no values coming in. Broker is working fine, can verify the topics and payloads with other mqtt clients. Somehow I'm not sure wether the datasource is set up correctly. The URIs I'm using are either tcp://ipaddress:1883 or mqtt://ipaddress:1883 (although not supported) and in both cases Grafana says 'MQTT connected'. When I try to explore the source there are no values coming in although they are published periodically.

Is there a way to find out wether Grafana is really connected? Meaning on the Grafana end - there's no access to the broker.

diepeterpan commented 1 year ago

Hi,

same here. No obvious reason for no values coming in. Broker is working fine, can verify the topics and payloads with other mqtt clients. Somehow I'm not sure wether the datasource is set up correctly. The URIs I'm using are either tcp://ipaddress:1883 or mqtt://ipaddress:1883 (although not supported) and in both cases Grafana says 'MQTT connected'. When I try to explore the source there are no values coming in although they are published periodically.

Is there a way to find out wether Grafana is really connected? Meaning on the Grafana end - there's no access to the broker.

Ditto here, tried various topic, and in explore, just don't get any data or error. :-(

Rumbelstilzchen commented 1 year ago

I'm facing the same error. Connection is successful but no data in response.

simonsmart99 commented 1 year ago

Ditto. The same problem. The connection to the broker is successful but the topic receives no data.

guenter-ms commented 10 months ago

Hello, I have exactly the same problem. Can anybody HELP?

simonsmart99 commented 10 months ago

I contacted Grafana support about this issue, who have confirmed that the MQTT data source has been deprecated and will not be developed any further. The recommendation was to use Telegraf to parse mqtt data into influxdb and then read the influxdb data into Grafana. This was a bit of a learning curve, but I do now have a very stable solution based upon this architecture. I hope this helps.

guenter-ms commented 10 months ago

Thank you! The recommendation "read the influxdb data into Grafana" means polling every 5 seconds instead of live streaming. Correct?

simonsmart99 commented 10 months ago

Yes, unfortunately 5s is the minimum poll time on Grafana Cloud. I haven't implemented my own instance of Grafana. Possibly that restriction doesn't apply. In my case 5s polling is good enough, but obviously not for all applications.

OlivierGre commented 10 months ago

I have succesfully implemented the solution with Telegraf + InfluxDB + Grafana but we wanted something lighter so we finally decided to implement an MQTT Client in an Android App. The source code is available here if you want to try: https://www.st.com/en/embedded-software/stsw-st25011.html

App on Google Play: https://play.google.com/store/apps/details?id=com.st.st25mqttclient

guenter-ms commented 10 months ago

Thank you. I need live data to grafana and found the WebSocket API Datasource. I could install but will get no answer. The Webservice is on nodered and answering fine, when calling via browser URL. Any idea whats wrong? See screenshots.

Datasource:

Bildschirmfoto 2023-08-21 um 17 58 52

Error:

Bildschirmfoto 2023-08-21 um 18 04 41

Nodered:

Bildschirmfoto 2023-08-21 um 17 57 32

Works from Browser:

Bildschirmfoto 2023-08-21 um 17 58 23