influxdata / influxdata/telegraf

Feature request for mqtt_consumer: ignore retained messages

Open
#10,824 2 comments 0 reactions 0 assignees View on GitHub
area/mqtt feature request help wanted size/l
Dominant language
Go
Stars
17.8k
Forks
5.8k
Avg merge
1d 20h
Merged PRs (30d)
161

Description

## Feature Request

When using the MQTT consumer input plugin, you can subscribe to topics that have a retained value. At the moment, retained messages are treated as any other message and their value it stored.

### Proposal:

Add a configuration setting to allow the mqtt_consumer input plugin to ignore retained messages.

### Current behavior:

1. Telegraf starts
2. mqtt_consumer subscribes to configured topics
3. Broker sends the retained messages for the configured topics
4. Telegraf stores the values in configures output.

### Desired behavior:

1. Telegraf starts
2. mqtt_consumer subscribes to configured topics
3. Broker sends the retained messages for the configured topics
4. Telegraf checks the config for the plugin, and if the option to ignore retained messages is set, it will NOT store the retained values.

### Use case:

I have sensors that publish their data to MQTT with the retain flag set. Currently, every time I restart telegraf, it stores the retained value again when I only want it to update when new messages arrive.

Contributor guide

Open the contributing guide

Research direction

Start with the mqtt_consumer input plugin, tracing how its configuration is read and how subscribed messages are handled. Add a configuration option for excluding retained messages, then verify that retained values are not stored while ordinary MQTT messages continue to be processed.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.