Hi, I am new to telegraf and i need help to understand how can i read the MQTT data, parse and send to influxdb.
data in MQTT explorer looks like
![image|578x500](upload://3tI3ycheStbT9DIgQkfANAOaBjV.png
I have been trying and below is my conf file
# # Read metrics from MQTT topic(s)
[[inputs.mqtt_consumer]]
servers = ["tcp://mqtt:1883"]
topics = [
"$SYS/#",
]
client_id = "Telegraf"
username = "******"
password = "******"
data_format = "influx"
[[outputs.influxdb_v2]]
urls = ["http://127.0.0.1:8086"]
token = "**********************************************************"
organization = "*****"
bucket = "power"
When i test the conf file, below is the result
PS C:\Program Files\InfluxData\telegraf> C:\"Program Files"\InfluxData\telegraf\telegraf.exe --config C:\"Program Files"\InfluxData\telegraf\telegraf.conf --test
2023-03-22T12:09:59Z I! Loading config file: C:\Program Files\InfluxData\telegraf\telegraf.conf
2023-03-22T12:09:59Z I! Starting Telegraf 1.26.0
2023-03-22T12:09:59Z I! Available plugins: 235 inputs, 9 aggregators, 27 processors, 22 parsers, 57 outputs, 2 secret-stores
2023-03-22T12:09:59Z I! Loaded inputs: cpu disk diskio kernel mem mqtt_consumer processes swap system
2023-03-22T12:09:59Z I! Loaded aggregators:
2023-03-22T12:09:59Z I! Loaded processors:
2023-03-22T12:09:59Z I! Loaded secretstores:
2023-03-22T12:09:59Z W! e[31mOutputs are not used in testing mode!e[0m
2023-03-22T12:09:59Z I! Tags enabled: host=MAPPG0001
2023-03-22T12:09:59Z W! [inputs.processes] Current platform is not supported
2023-03-22T12:09:59Z W! [inputs.kernel] current platform is not supported
2023-03-22T12:10:01Z E! [agent] Starting input inputs.mqtt_consumer: network Error : dial tcp: lookup mqtt: no such host
> mem,host=MAPPG0001 available=5317537792i,available_percent=61.91276023969116,total=8588759040i,used=3271221248i,used_percent=38.08723976030884 1679487001000000000
> disk,device=C:,fstype=NTFS,host=MAPPG0001,mode=rw,path=\C: free=89986056192i,inodes_free=0i,inodes_total=0i,inodes_used=0i,total=135771664384i,used=45785608192i,used_percent=33.72250638579901 1679487001000000000
> disk,device=D:,fstype=NTFS,host=MAPPG0001,mode=rw,path=\D: free=15751868416i,inodes_free=0i,inodes_total=0i,inodes_used=0i,total=17177767936i,used=1425899520i,used_percent=8.300842841238392 1679487001000000000
> disk,device=S:,fstype=NTFS,host=MAPPG0001,mode=rw,path=\S: free=68599078912i,inodes_free=0i,inodes_total=0i,inodes_used=0i,total=68701646848i,used=102567936i,used_percent=0.14929472684538114 1679487001000000000
> diskio,host=MAPPG0001,name=S: io_time=0i,iops_in_progress=0i,merged_reads=0i,merged_writes=0i,read_bytes=12288i,read_time=0i,reads=3i,weighted_io_time=0i,write_bytes=0i,write_time=0i,writes=0i 1679487001000000000
> diskio,host=MAPPG0001,name=C: io_time=0i,iops_in_progress=0i,merged_reads=0i,merged_writes=0i,read_bytes=2963092480i,read_time=366i,reads=192569i,weighted_io_time=0i,write_bytes=1678793216i,write_time=72i,writes=43477i 1679487001000000000
> diskio,host=MAPPG0001,name=D: io_time=0i,iops_in_progress=0i,merged_reads=0i,merged_writes=0i,read_bytes=27181568i,read_time=0i,reads=966i,weighted_io_time=0i,write_bytes=204251136i,write_time=4i,writes=4235i 1679487001000000000
> system,host=MAPPG0001 load1=0,load15=0,load5=0,n_cpus=2i 1679487001000000000
> system,host=MAPPG0001 uptime=7028i 1679487001000000000
> system,host=MAPPG0001 uptime_format=" 1:57" 1679487001000000000
> swap,host=MAPPG0001 free=7029841920i,total=9930936320i,used=2901094400i,used_percent=29.212697640175783 1679487001000000000
> swap,host=MAPPG0001 in=0i,out=0i 1679487001000000000
> cpu,cpu=cpu0,host=MAPPG0001 usage_guest=0,usage_guest_nice=0,usage_idle=69.6969696969697,usage_iowait=0,usage_irq=0,usage_nice=0,usage_softirq=0,usage_steal=0,usage_system=12.121212121212121,usage_user=18.181818181818183 1679487002000000000
> cpu,cpu=cpu1,host=MAPPG0001 usage_guest=0,usage_guest_nice=0,usage_idle=60.60606060606061,usage_iowait=0,usage_irq=0,usage_nice=0,usage_softirq=0,usage_steal=0,usage_system=24.242424242424242,usage_user=15.151515151515152 1679487002000000000
> cpu,cpu=cpu-total,host=MAPPG0001 usage_guest=0,usage_guest_nice=0,usage_idle=65.15151515151516,usage_iowait=0,usage_irq=0,usage_nice=0,usage_softirq=0,usage_steal=0,usage_system=18.181818181818183,usage_user=16.666666666666668 1679487002000000000
2023-03-22T12:10:03Z E! [inputs.mqtt_consumer] Error in plugin: network Error : dial tcp: lookup mqtt: no such host
2023-03-22T12:10:03Z E! [telegraf] Error running agent: input plugins recorded 1 errors