Dear All,
i have a mosquitto broker that accept only TSL connection, below the configuration of telegraf consumer
[[inputs.mqtt_consumer]]
servers = ["ssl://10.0.1.13:8883"]
## Topics that will be subscribed to.
topics = [
"mytopic/*"
]
qos = 1
client_id = "telegraf"
## Username and password to connect MQTT server.
username = "user"
password = "pwd"
## Optional TLS Config
tls_ca = "/etc/telegraf/ca.pem"
tls_cert = "/etc/telegraf/cert.pem"
tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
insecure_skip_verify = true
when run telegraf it raise an error
! [telegraf] Error running agent: starting input inputs.mqtt_consumer: not Authorized
The broker configuration is ok because mqtt explorer works fine with the same user&pass and certificate.
How i can debug in deep to understand the problem?
thank in advance!
Well that’s the answer from the server so there is something wrong with the authentication or authorization… Did you try to subscribe to the server topics from the Telegraf host with exactly the same credentials?
below the output of telegram consumer, i think the problem should be the mqtt versione protocol, is possibile?
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [client] Connect()
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [store] memorystore initialized
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [client] about to write new connect msg
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [client] socket connected to broker
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [client] Using MQTT 3.1.1 protocol
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [net] connect started
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [net] received connack
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [client] Trying reconnect using MQTT 3.1 protocol
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [client] socket connected to broker
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [client] Using MQTT 3.1 protocol
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [net] connect started
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [net] received connack
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [client] Failed to connect to a broker
2024-08-26T14:47:16Z D! [inputs.mqtt_consumer] [store] memorystore closed
Yeah it might be possible that the server expects another protocol version (likely v5)… Do you have access to the server log or can get the used protocol from a working client?
now is working, the problem was Mosquitto… It need to be rebooted when you create a new user and password…
thanks to all!
1 Like