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
    urls = ["<removed>"]
    bucket = "ems-esp"
    token = "<removed>"
    organization = "<removed>"

# Below is line 128 where the error occurs
  ## 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://"]

  topics = [
  data_format = "json"

  servers = ["tcp://"]
  topics = [
  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.


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.