-
Notifications
You must be signed in to change notification settings - Fork 51
MQTT data not received #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I am having the same problem |
The same problem :( I see connection in EMQX dashboard, but it seems that there is no subscription from Grafana. |
I always got issue with this MQTT plugin and the "Explore data" feature. Try creating a dashboard and add a panel using your MQTT connection. Then enter the topic and switch to table view and you should see your data. From there, you will need to play with the visualization you want for a state change representation. |
We ended by running container with mosquito, that collects required topics and sends them to loki. Works like a charm. |
@ArchiZ0 |
@bandi22 Sorry to hear that... What is your use-case? How often data are sent in the topic? This MQTT plugin is for streaming data only as far as I know. There's no storage of any sort and small change like modifying the time range will reset the content. We had to use a trick on the collector side to always keep a small buffer of data and when connection to topic are detected, we start by dumping that buffered data in the topic and then continue the live streaming. In my case, we end up using this plugin as a real-time view for equipment metrics and we use it as a live debugging tools. I use variables to select an equipment dynamically and connect to the related topics. For periodic / more historical oriented use-cases, we use a different datasource. |
Actually it's not very clear from documentation, that there is no storage inside. We moved to mosquito + Loki after realizing that. |
@nosovk Well, is there any "client-side local storage" at all to any data sources in Grafana?. I'm no Grafana expert but with all the data sources we've used so far, when you reload the page or change the time range, the data is re-read from the data source, like in your case, Loki... but it seems to be the case with others too, like InfluxDB or BigQuery, which are other data sources we're using. What's different with MQTT is once the data is read by the client from a topic, the data is gone, by design... Even with the broker feature "retained messages", only the last one received in a specific topic is persisted at any time:
Reconnecting to the topic will simply read the last one and any subsequent data published. |
Yep, you have correctly described all. The main point is that users mostly want to connect their house temperature measurement to grafana. And its a bit unclear that it wouldn't work with that datasource. That's why there are so manu issues where people complain that something is not working, but its just not intended to work like they think. |
Data is sent every few seconds or so from a machine, so I guess we could say it is live data, not historical. When I'm subscribed to the same topic on the broker with an MQTTX client, I can see the messages appearing, one after the other, live, but no data is shown in Grafana. |
@bandi22 can you share the data you sent to the topic again please? This is very odd you don't see anything. |
so, i've read all the topic. My scope is to have a fixed value to multiply some data with it. No need for graphs or any other cool representation.
MQTT Explorer |
@wavelov3r Sorry but what is the expectation here? MQTT is not about data persistence, this is not a time-series data store... it will only retain the last value by design, and when subscribed using that plugin, it will continue adding until you refresh the page... which I believe you understand. Your data seems to be a simple float sent in a topic without structure (named field using JSON) or timestamp... ...Still, here's an example using a "simple" topic that dump a "simple" float every 3 second: and here's the data in MQTTX client: I'm using the community version of EMQX and did nothing special to the broker. |
@ArchiZ0 the expectation is clear, i wrote it. to have a (one) number for multiplications (it's a price per kW). In the documentation i read: This plugin automatically supports topics publishing numbers, strings, booleans, and JSON formatted values. , so i tought "raw numbers are ok". Ending the message with other unsuccessful json tries: MQTT EXPLORER |
same here, see screen shots. Plugin version: 11.0 beta 2 MQTT Explorer Grafana 11.1.4 Any hint would be appreciated. |
@wavelov3r My bad, I miss the part you want to display the retained message too. I replicate your use-case and I believe I understand what's happening at least for the retained message... new messages in the topic always worked for me so I'll give you a better view of my setup. Specifically about the retained message not displaying, I believe this has to do with the MQTT plugin optimizing / reusing existing connection to the broker and subscription to a topic vs. re-connecting and re-subscribing with a new client-id on each dashboard reload. It is my understanding a MQTT client will get the retained message only once when it subscribed to the topic... if its already subscribed, it will only receive the subsequent update when it arrive. Here's my test to confirm:
In MQTTX Client:
In EMQX management dashboard:
In Grafana:
From there, I restarted Grafana to make sure I start fresh (no MQTT connection or subscription) then I got to the dashboard I just created. In MQTTX client, I clearly see the Grafana MQTT plugin connecting and the subscribing to the ...and after ~4 or 5 seconds, the retained message appear in both panels: Using the MQTTX client, I published a new message with the number So far, all normal behavior... but now the non-intuitive behavior start: If you refresh the Grafana dashboard in the browser (normal or forced refresh), the panels will show no data. Looking at the client events in the MQTTX client, I clearly see NO new subscription... which mean the MQTT plugin retain the current subscription to From there, if you leave the Grafana dashboard, you'll eventually see the plugin detecting nobody is looking at that dashboard anymore and unsubscribed from the topic. I do see sometime, when you do something like changing the time range, the plugin seems to unsubscribed and subscribed again immediately... in that case, the retained message will show after 4-5 seconds. But, from time to time, normally after quick test back to back, the retained message is not displayed... which can probably be a bug but I don't see any log that can confirm this. In any case, this is probably more a behavior that doesn't match the expectation. We can probably asked the contributor of this plugin to add an option to use different client-id to subscribed to topic on all event in the dashboard, similar to the variable refresh on dashboard reload. Let me know if you're able to replicate my test. Hope this help. |
same issue here , topics are being updated (checked with mosquitto_sub) and graphana says connected to mosquitto broker no problem. But the queries are not receiving a n y t h i ng, dry |
Similar problem here - there is something very strange going on with the topic mapping between the "query" layer and the MQTT layer. I have a broker which is receiving messages on 5 topics:
If I set the query topic as As soon as I try to filter the query down to a specific topic (with or without the leading slash), I stop getting any data at all. |
this is very annoying i think there is an issue with / started topic names
…On Mon, 2 Dec 2024, 09:10 Alyssa Coghlan, ***@***.***> wrote:
Similar problem here - there is something *very* strange going on with
the topic mapping between the "query" layer and the MQTT layer.
I have a broker which is receiving messages on 5 topics:
- /sensors/temp/C
- /sensors/temp/F
- /sensors/hidx/C
- /sensors/hidx/F
- /sensors/humidity
If I set the query topic as #, then all 5 signals show up as values in
the exploration query view (I'm monitoring them separately via
mosquitto_sub, so I can identify them by value).
As soon as I try to filter the query down to a specific topic (with or
without the leading slash), I stop getting any data at all.
—
Reply to this email directly, view it on GitHub
<#107 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGD36N5NAXACG7L5KI4KEEL2DQIXZAVCNFSM6AAAAABMANN4D6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJQHA2DAOJUGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I'm just popping in to say that I'm experiencing the same issue originally being discussed here -- the MQTT plugin connects and gets a green checkmark at the "save & test" stage but then does not receive any data under any circumstances, even when I confirm that data is being sent (e.g. using MQTT Explorer). The issue isn't about data persistence -- nothing ever shows up at all. I've tried specific topics where I knew data was coming in, and I've also tried the wildcard topic # and still got nothing. Regarding topic names starting with a slash, they are discouraged in MQTT (see here ) but they ought to work. But that's not the issue I'm having.
|
Issue:
No MQTT data is received in Grafana via TCP, despite the connection test being successful ("MQTT Connected") and the Grafana client showing up as 'Connected' in EMQX.
Messages are broadcasted in the broker:
"Explore data" option and dashboards show no data, time range is set to <1 minute. Subscription and the topic name is set correctly in the queries:
Explore data:
Dashboard:
Grafana logs show no apparent errors.
Environment:
The text was updated successfully, but these errors were encountered: