# Telegraf input plugin "mqtt\_consumer" stops working

**URL:** <https://community.influxdata.com/t/telegraf-input-plugin-mqtt-consumer-stops-working/39406>\
**Category:** Telegraf\
**Tags:** mqtt\
**Created:** [November 20, 2024, 10:44am UTC](https://community.influxdata.com/t/telegraf-input-plugin-mqtt-consumer-stops-working/39406 "2024-11-20T10:44:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cortlieb](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cortlieb](https://community.influxdata.com/u/cortlieb)\
**Post date:** [November 20, 2024, 10:44am UTC](https://community.influxdata.com/t/telegraf-input-plugin-mqtt-consumer-stops-working/39406/1 "2024-11-20T10:44:17Z")

</div>

I’m using the `inputs.mqtt_consumer` plugin to retrieve some data from a LoRaWAN networkserver (TTN). I noticed recently that no more data where written into my InfluxDB.  
I restarted telegraf and data were written again.

I looked into telegraf’s log-files and found error entries for all concerned mqtt\_consumer instances, e.g.

- `E! [inputs.mqtt_consumer::ttn_consumer_ow] Error in plugin: connection lost: read tcp 172.19.0.3:42600->52.212.223.226:1883: read: connection reset by peer`
- `E! [inputs.mqtt_consumer::ttn_consumer_ow] Error in plugin: network Error : read tcp 172.19.0.3:33402->63.34.215.128:1883: i/o timeout`

I guess it can happen that the connection between the server running telegraf and the mqtt-server is temporarily interrupted. But why does that cause the telgraf input plugins to quit working?

Here are some more observations:

- telegraf is running in a docker container
- other input- and output plugins of the same telegraf instance continued working without issue
- As you can see in the example above it seemed that the IP address for the configured mqtt-server changed.  
Maybe that’s just a normal process (e.g. for something like load-balancing?).  
Maybe that causes the telegraf issue?  
On the other hand there are also error entries in the log that have the same IP address for both error messages (`read: connection reset by peer` / ` i/o timeout`).
- when I restarted the telegraf container data started immediately to flow again from the mqtt-server to the InfluxDB

Does someone has an advice how to prevent telegraf from stopping plugins when a connection interruption occurs, respectively enable it to start again when the connection is reestablished?

---

<div class="post-metadata">

**Author:** ![simv](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/simv/32/16911_2.png) [@simv](https://community.influxdata.com/u/simv)\
**Post date:** [November 25, 2024, 4:57am UTC](https://community.influxdata.com/t/telegraf-input-plugin-mqtt-consumer-stops-working/39406/2 "2024-11-25T04:57:37Z")

</div>

Hi there, I am experiencing this as well.

This is not running in docker, but a standard install on a raspberry pi.  
Distributor ID: Debian  
Description: Debian GNU/Linux 12 (bookworm)  
Release: 12  
Codename: bookworm  
6.6.31+rpt-rpi-v8  
Telegraf 1.32.1 (git: HEAD@946e4d7d)

---

<div class="post-metadata">

**Author:** ![cortlieb](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cortlieb](https://community.influxdata.com/u/cortlieb)\
**Post date:** [November 25, 2024, 1:51pm UTC](https://community.influxdata.com/t/telegraf-input-plugin-mqtt-consumer-stops-working/39406/3 "2024-11-25T13:51:24Z")

</div>

Ok, then it is already two of us! 😊  
Maybe someone from the staff (@Anaisdg ?) can provide an answer?

---

<div class="post-metadata">

**Author:** ![srebhan](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/srebhan/32/8572_2.png) [@srebhan](https://community.influxdata.com/u/srebhan)\
**Post date:** [December 11, 2024, 1:21pm UTC](https://community.influxdata.com/t/telegraf-input-plugin-mqtt-consumer-stops-working/39406/4 "2024-12-11T13:21:36Z")

</div>

Could you please check of there already is an issue in the project and if not create a new one!?

---

<div class="post-metadata">

**Author:** ![cortlieb](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cortlieb](https://community.influxdata.com/u/cortlieb)\
**Post date:** [December 11, 2024, 2:43pm UTC](https://community.influxdata.com/t/telegraf-input-plugin-mqtt-consumer-stops-working/39406/5 "2024-12-11T14:43:54Z")

</div>

Hi @srebhan ,

I’m not sure if I understand your post. 🤔  
You mean if there is already a bug-report somewhere (not sure where InfluxDB issue reports are officially filed) regarding the described telegraf plugin crash?

---

<div class="post-metadata">

**Author:** ![cortlieb](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cortlieb](https://community.influxdata.com/u/cortlieb)\
**Post date:** [December 12, 2024, 7:35am UTC](https://community.influxdata.com/t/telegraf-input-plugin-mqtt-consumer-stops-working/39406/6 "2024-12-12T07:35:01Z")

</div>

It happened 2 days ago again. Unfortunately I noticed it only yesterday, so I lost a day of data. 😩  
Since there is no answer on how to avoid this from happening: is there at least a way to monitor the operation of the plugins? As I said above, telegraf as such continues to operate, it’s just the mqtt-plugin that stops working.

---

<div class="post-metadata">

**Author:** ![cortlieb](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cortlieb](https://community.influxdata.com/u/cortlieb)\
**Post date:** [December 12, 2024, 7:49am UTC](https://community.influxdata.com/t/telegraf-input-plugin-mqtt-consumer-stops-working/39406/7 "2024-12-12T07:49:48Z")

</div>

I looked at telegraf’s GitHub page and indeed I found an issue entry that is related to this topic ([MQTT consumer plugin disconnects frequently and can not reconnect successfully · Issue #16293 · influxdata/telegraf · GitHub](https://github.com/influxdata/telegraf/issues/16293)).  
It was filed just 2 days ago.

---

<div class="post-metadata">

**Author:** ![zhenjianlee](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/zhenjianlee/32/19971_2.png) [@zhenjianlee](https://community.influxdata.com/u/zhenjianlee)\
**Post date:** [June 16, 2025, 9:05am UTC](https://community.influxdata.com/t/telegraf-input-plugin-mqtt-consumer-stops-working/39406/8 "2025-06-16T09:05:51Z")

</div>

Thank you for pointing me to this thread. This has been a pain point for me in development stage. I had to write a monitoring execd plugin to send alerts to telegram bot whenever the metric stop coming in. Will check up on this closely.
