Transformation of MQQT data

Dear friends,

I’ve had a lot of fun with influxDb, MQTT, Grafana etc. in the last few days. Unfortunately, I can’t get any further at one point. I receive a simple JSON content from an MQTT broker that I would like to transform and, if necessary, select.

  "selflowtemp": 58,
  "heatingpumpmod": 100,
  "outdoortemp": 2,
  "curflowtemp": 58,
  "rettemp": 55.2,

By specifying in the Telegraf configuration file

data_format = "json"

The transfer to fluxDb also works wonderfully.

Unfortunately, all data comes in under _measurement = mqqt_consumer. That shouldn’t be the case, I would like to run in the temperature values under _measurement = temperature etc. Also add a few tags, such as the location.

Actually exactly what can be seen in the black picture at the following link in the top right.

If I understood it correctly, then you should first

data_format = "json_v2"

and provide additional information accordingly. But after this change nothing is taken over anymore.

What information do I have to make in the configuration file so that the following input would be provided based on the example above:

temperature,location=West,name=Boiler1 selflowtemp=58,outdoortemp=2,curflowtemp=58,rettemp=55.2

even better:

temperature,location=West,name=Boiler1 mytempname1=58,mytempname2=2,mytempname3=58,mytempname4=55.2

I don’t understand something, but I hope for your help :slight_smile:

Best regards from Germany


You do not need to change parsers to set the measurement name and add tags.

To set the measurement name of a metric from an input you can use the name_override option to set the measurement name.

    name_override = "temperature"

To set additional tags you can add a table at the end of the plugin configuration:

    location = "West"
    name = "Boiler1"

Finally, there is the rename processor that lets you rename field names.

If you really do want to rename everything, then it may make more sense to use the json_v2 parser to set all of these options. You said you tried using this parser but it did not work. Can you please share the config you used?


many thanks for the quick response. I think I still have a fundamental error in thinking or understanding problem here.

The MQTT broker supplies corresponding data from various sources. So I have 2 boilers that provide temperatures, line pressure, degree of modulation, consumption, etc. I thought you should combine all temperatures, pressures etc. under one individual measurement?!

Really exactly like this picture:

Here is my complete configuration:

  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  hostname = ""
  omit_hostname = false
  urls = ["http://localhost:8086"]
  token = "xxxxxxxxxxxxxxxxxxxxx=="
  organization = "TestOrg"
  bucket = "test"
  servers = ["tcp://"]
  topics = [
   data_format = "json"