Telegraf Error: configuration specified the fields ["measurement_name"], but they weren't used

I am not experienced with Telegraf and I have run into this problem. The config was previously working, but then something changed and I don’t know what the issue is (and didn’t backup the working config!).

So any help would be appreciated.

I have configured Telegraf to collect from an mqtt queue, but it is not working and I can’t see the reason why.

2022-11-15T19:30:13Z E! [telegraf] Error running agent: Error loading config file /etc/telegraf/telegraf.conf: plugin inputs.mqtt_consumer: line 128: configuration specified the fields [“measurement_name”], but they weren’t used

The relevant config

# Configuration for sending metrics to InfluxDB
[[outputs.influxdb_v2]]
    urls = ["<removed>.aws.cloud2.influxdata.com"]
    bucket = "ems-esp"
    token = "<removed>"
    organization = "<removed>"

# Below is line 128 where the error occurs
[[inputs.mqtt_consumer]]                      
  ## Broker URLs for the MQTT server or cluster.  To connect to multiple
  ## clusters or standalone servers, use a separate plugin instance.
  ##   example: servers = ["tcp://localhost:1883"]
  ##            servers = ["ssl://localhost:1883"]
  ##            servers = ["ws://localhost:1883"]
  servers = ["tcp://192.168.178.61:1883"]

  topics = [
    "ems-esp/boiler_data_ww",
    "ems-esp/boiler_data",
    "ems-esp/thermostat_data",
    "ems-esp/thermostat_data_hc1",
    "ems-esp/solar_data",
    "ems-esp/heartbeat",
    "ems-esp/info",
  ]
  data_format = "json"


[[inputs.mqtt_consumer]]
  servers = ["tcp://192.168.178.61:1883"]
  topics = [
    "shellies/ht_lounge/info"
  ]
  data_format = "json"

But the line the error points to is just the definition [[inputs.mqtt_consumer]] and I don’t see the problem. Nor can I find anything else in the file that is incorrect.

I am running Telegraf in docker, in case that makes a difference.

Thanks.

The errors says that you have an option measurement_name in line 128 of /etc/telegraf/telegraf.conf and this is not known to telegraf. Can you please post the full config?
The background is that we had some version (sorry for not knowing exactly which) where the check for unknown options did not work reliably and this is fixed now. However, the option mentioned above is either misspelled or not existing for the plugin you specified there…

Here is a link to the file in full:

(Sorry as a new user I can’t attach it here, and I get a strange error (can only post 2 links??) when trying to past the whole file as text in the question or a reply).

No worries about the document sharing!

In line 162 of that file you have set measurement_name = "heating" in an [[inputs.mqtt_consumer]] instance. However, mqtt_consumer does not have such an option. If you want to set the measurement name there, you need to use the name_override setting (see general configuration options for inputs).

Thats solved the problem. Thanks very much.