I'm literally tearing my hair out (what little hair I have anyway!) as I cannot get Telegraf to connect to any MQTT broker. I was using Mosquitto locally but have tested public servers to rule that out yet I have exactly the same problem. I'm sure I'm doing something really stupid but I'm kind of out of ideas!
*1590649770: New connection from 127.0.0.1 on port 1883.* *1590649770: New client connected from 127.0.0.1 as Telegraf-Consumer-NalQU (c1, k60).* *1590649770: No will message specified.* *1590649770: Sending CONNACK to Telegraf-Consumer-NalQU (0, 0)* *1590649770: Received SUBSCRIBE from Telegraf-Consumer-NalQU* *1590649770: Socket error on client Telegraf-Consumer-NalQU, disconnecting.*
I was having the same problem with a public MQTT broker too so I figured the problem must have been in my Telegraf config..... turns out I had a single line in the conf which was still accidentally commented out (topics area which didn't correctly close the list).
My bad and I should have noticed earlier -- I think I was fixated on the socket error which was a misleading.