diff --git a/etc/telegraf.conf b/etc/telegraf.conf index d81e1b993..0a1607281 100644 --- a/etc/telegraf.conf +++ b/etc/telegraf.conf @@ -3918,8 +3918,15 @@ # ## schema can be tcp, ssl, or ws. # servers = ["tcp://localhost:1883"] # -# ## MQTT QoS, must be 0, 1, or 2 +# ## QoS policy for messages +# ## 0 = at most once +# ## 1 = at least once +# ## 2 = exactly once +# ## +# ## When using a QoS of 1 or 2, you should enable persistent_session to allow +# ## resuming unacknowledged messages. # qos = 0 +# # ## Connection timeout for initial connection in seconds # connection_timeout = "30s" # diff --git a/plugins/inputs/mqtt_consumer/README.md b/plugins/inputs/mqtt_consumer/README.md index df7869a86..0ec668c40 100644 --- a/plugins/inputs/mqtt_consumer/README.md +++ b/plugins/inputs/mqtt_consumer/README.md @@ -13,8 +13,16 @@ The plugin expects messages in the ## MQTT broker URLs to be used. The format should be scheme://host:port, ## schema can be tcp, ssl, or ws. servers = ["tcp://localhost:1883"] - ## MQTT QoS, must be 0, 1, or 2 + + ## QoS policy for messages + ## 0 = at most once + ## 1 = at least once + ## 2 = exactly once + ## + ## When using a QoS of 1 or 2, you should enable persistent_session to allow + ## resuming unacknowledged messages. qos = 0 + ## Connection timeout for initial connection in seconds connection_timeout = "30s" diff --git a/plugins/inputs/mqtt_consumer/mqtt_consumer.go b/plugins/inputs/mqtt_consumer/mqtt_consumer.go index 58074af79..5853ad939 100644 --- a/plugins/inputs/mqtt_consumer/mqtt_consumer.go +++ b/plugins/inputs/mqtt_consumer/mqtt_consumer.go @@ -53,8 +53,15 @@ var sampleConfig = ` ## schema can be tcp, ssl, or ws. servers = ["tcp://localhost:1883"] - ## MQTT QoS, must be 0, 1, or 2 + ## QoS policy for messages + ## 0 = at most once + ## 1 = at least once + ## 2 = exactly once + ## + ## When using a QoS of 1 or 2, you should enable persistent_session to allow + ## resuming unacknowledged messages. qos = 0 + ## Connection timeout for initial connection in seconds connection_timeout = "30s"