grafana / mqtt-datasource

MQTT Datasource for Grafana allows streaming data from any MQTT broker running either locally or remotely.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

retained MQTT messages not received upon panel refresh

yoyolb opened this issue · comments

Hello,

I have set up the mqtt-datasource and it works.
But I get only messages sent after panel is shown, even for messages set with "retained flag" in MQTT broker.
So, my panel is empty until the next message is sent.
I expect to get the retained message upon panel initialization or refresh for better user experience.

Lionel.

I believe I'm also seeing this same condition. Since I'm not sure if this is an issue with the plugin or a core Grafana issue, I'm going to report to both projects.

Here is my environment. It is a fresh build within the last week. My raw data originates from an IoT controller which is monitoring the water level, temp, and humidity in a sump hole. I'm using Grafana to graph the data and generate an alert if the levels exceed a specific value or if there is no data stream.

The following packages are running on Debian 11.2 on a Raspberry Pi4 4GB board however I saw the same issues when running on Debian 11.2 in a VMware guest instance with 8GB of memory on a much more capable machine (CPU).

grafana/stable, now 8.4.3 arm64 (Edit: not resolved with Ver 8.4.4)
mosquitto/stable, now 2.0.11-1 arm64
grafana/mqtt-datasource current version

I have tested Firefox, Safari, and Chrome on macOS 10.15.7 and Firefox and Chrome on Win11. All yield the same result.

Closing the browser while viewing the dashboard causes all collected data to be lost and for the DataSourceNoData alert to be triggered. After about a minute, the Resolved message is received and data collection resumes. Data will continue to collect normally until I open a browser to view the data, where it continues to work right up to the point where the window is closed again - resetting the data and triggering the data loss alarm.

It somewhat defeats the purpose of having a control panel if you can't monitor it at least occasionally. Currently, if I look, I can never close the window.

The grafana.log shows the following relevant entries

logger=context t=2022-03-17T08:38:08-0400 lvl=info msg="Request Completed" method=GET path=/ status=302 remote_addr=192.168.2.10 time_ms=0 size=29 referer=
logger=http.server t=2022-03-17T08:38:24.64-0400 lvl=info msg="Successful Login" User=admin@localhost
logger=context t=2022-03-17T08:38:25.22-0400 lvl=info msg="Request Completed" method=GET path=/api/live/ws status=0 remote_addr=192.168.2.10 time_ms=2 size=0 referer=
logger=plugin.grafana-mqtt-datasource t=2022-03-17T08:39:35.39-0400 lvl=info msg="stop streaming (context canceled)"
logger=alertmanager org=1 level=debug component=dispatcher msg="Received alert" alert=DatasourceNoData[24f10d8][active]
logger=alertmanager org=1 level=debug component=dispatcher aggrGroup="{}/{scope=\"house\"}:{}" msg=flushing alerts=[DatasourceNoData[24f10d8][active]]
logger=alertmanager org=1 level=debug component=dispatcher receiver="House Alert" integration=email[0] msg="Notify success" attempts=1
logger=alertmanager org=1 level=debug component=dispatcher aggrGroup="{}/{scope=\"house\"}:{}" msg=flushing alerts=[DatasourceNoData[24f10d8][resolved]]
logger=alertmanager org=1 level=debug component=dispatcher receiver="House Alert" integration=email[0] msg="Notify success" attempts=1