What Grafana version and what operating system are you using?
Grafana v10.4.1 (d3ce857c0e)
Debian GNU/Linux 12 (bookworm)
Linux 6.6.20+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.20-1+rpt1 (2024-03-07) aarch64 GNU/Linux
What are you trying to achieve?
I’m trying to build a dashboard for MQTT data.
How are you trying to achieve it?
I installed the plugin, added a data source (connection test ok) and I added a time series panel to my dashboard.
What happened?
Data is fetched properly and shown in the panel:
But once I navigate away from the dashboard the historic data is lost and it shows “no data”. Even if I just change the time range selection. Seems like the data is not stored properly. Not sure if this is an MQTT or a database issue?
What did you expect to happen?
I freshly installed Grafana and was hoping data is stored in the default sqlite db as per documentation without any additional manual steps on my side, isn’t it?
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
No error in the UI, except the “no data” info. Whenever I update the time range the grafana.log write these messages:
I was assuming it is stored in the default sqlite DB. But it seems like it is not, this DB is just used for UI settings, dashboards etc.
However, I wonder how to use the MQTT plugin reasonably then? If I just see the data received since I opened the dashboard and no historic data it doesn’t make sense.
First thanks for trying to help me with this. Didn’t notice the reply though.
Unfortunately this is not how MQTT works. I use a so called “MQTT broker” (Mosquitto) and I think the methodology is similar to Apache Kafka. You can publish information via “topics” to send information. To receive information the receiving program has to subscribe to that specific topic. Only after subscription it will receive relevant data and any data will only be received once.
So that’s why I wonder how a proper Grafana MQTT dashboard should be configured? Of course I could write a little program to collect the MQTT data and write it to a database. Then I could query this DB from Grafana. But what is the point in the MQTT data source then? How am I supposed to use it properly when data is stored nowhere?
I think the subtle difference is that once a dashboard is saved GRAFANA streams data directly to the panel data buffer which you may readily access and download etc.
However as soon as any dashboard change is made and saved the panel data buffer/queue is purged as you note.
Below is an MQTT dashboard which has just started steaming data as you can see
Out of interest the exact same issues arise with the node-red dashboard chart whether it be version 1 or version 2 dashboard charts.
Node-red has a similar issues so it is not unique to GRAFANA.
Maybe if the GRAFNA panel could distinguish between cosmetic dashboard changes opposed to query changes then it might do what you require but that would be a hell of a mission to do.
I could live with the behaviour you describe. But my issue is not even related to changing the dashboard itself. I just navigate to other areas within Grafana and anytime I open the dashboard it is empty again - just collecting the data from the time I opened it and then being initialized whenever I leave it and come back.
Just to chime in here, when I first set up MQTT with Grafana, I too was disappointed that just closing the dashboard and then coming back would cause the 5 minutes or whatever of history to disappear and then start again. For that reason, today the only panel that I use the MQTT plugin with his the Stat Panel, which essentially gives me a nearly instantaneous value of the parameter that I am monitoring.