MQTT publishing somehow received - but something is wrong

Hi,
I’m totaly new to this stuff and I have problems to find the answer for my question cause i do not know how to ask excactly on the point.
So I did a screenshot to show my result.
I have set up node-red, mosquitto, telegraf and influxdb on a raspberry pi 4.
For every application I used docker.
Everything seems to be working but if I send a mqtt topic/message to the broker, it somehow writes into the database but not the way it should. so I am not able to use the data.
If I make “show measurements”
I get a list like in the screenshot. The first 8 lines where just there.
The last two were generated after I send a mqtt message to the topic “sensors” which was formated like this:
​temp,site=room1 value=13
​hum,site=room1 value=55

what is going wrong? which additional information do you need to help me?

kind regards

Can you share your Telegraf config?

It looks like you’re getting some extra data in the Line Protocol being sent to Influx, and so my first guess is that Telegraf isn’t set up quite right to parse the MQTT data.

The fact that the extra characters are the same for both measurements might back this guess up.

yes of course. I do not understand following: does telegraf send the data to influxdb or does telegraf send data to node-red which is forwarding the data to influxdb?
for my actual system I did just followed this manual: EASY SETUP Raspberry Pi Docker Portainer MQTT InfluxDB Telegraf Node-RED Grafana Dashboard IoT - YouTube
using docker-composer.
Before I did that, I tried this manual. It seems to be quiet the same but the setup is manually.
Raspberry Pi IoT: Sensors, InfluxDB, MQTT, and Grafana - DZone
when I use the second manual, I can make a nice table in the database by sending a mqtt-message like this: temp,site=room1 value=28
the same thing does not work with my actual composer-made system.

so, here is the telegraf.conf… (rename it to *.conf)
thanks so muchtelegraf.gz (8.7 KB)

Thanks @rolfderwolf

What I /think/ happens, is that Telegraf sends the data to Influx, and everything sends it data to Telegraf.

The only input handler in your Telegraf config is MQTT, so that would make sense.

Looking at the config, line 173:

 ## Topics that will be subscribed to.
 topics = [
 "telegraf/host01/cpu",
 "telegraf/+/mem",    
  "sensors/#",
 ]

You can see it is subscribed to three topics. I think the most interesting one is “sensors/#” the # indicates a wildcard. So any topic that starts “sensors/” will get processed by Telegraf.

Further down the config, line 232 you see:

data_format = "influx"

That tells Telegraf that the payload part of the MQTT message will be in Line Protocol format.

So you should be able to send a message to the topic something like sensors/foo
with the payload: temp,site=bathroom value=25

(That’s the same example as from the dzone article you linked to.)

That should all work, so I think perhaps the problem was in the MQTT payload you originally sent.

I’m afraid I don’t have any experience with Node Red, so I can’t really comment on what’s going on there - but it looks like the InfluxDB and Telegraf bits are configured correctly, just that the data that’s being sent is perhaps not in the exact right format.

Hope that helps, sorry I can’t give you a definitive answer.