Not luck with these settings.
omit_hostname=true
topic_prefix = “devices/{clientID}messages/events/”
-
If I put omit_hostname = true, messages continue without arriving, If I redirect output to local broker MQTT (change all choices for SSL, and redirect to one simple local MQTT to port 1883). I see that subtopic for hostname is not erased, only appears a blank space as shown in the screenshot.
-
On the other hand, I must fix topic prefix as “devices/{clientID}/messages/events/” in order fits to Azure IoT Hub schema.
-
In this case {clientID} is testInfluxDB.
[[outputs.mqtt]]
# ## MQTT Brokers
# ## The list of brokers should only include the hostname or IP address and the
# ## port to the broker. This should follow the format `[{scheme}://]{host}:{port}`. For
# ## example, `localhost:1883` or `mqtt://localhost:1883`.
# ## Scheme can be any of the following: tcp://, mqtt://, tls://, mqtts://
# ## non-TLS and TLS servers can not be mix-and-matched.
servers=["tcp://192.168.1.123:1883"]
#
# ## Protocol can be `3.1.1` or `5`. Default is `3.1.1`
# procotol = "3.1.1"
#
# ## MQTT Topic for Producer Messages
# ## MQTT outputs send metrics to this topic format:
# ## <topic_prefix>/<hostname>/<pluginname>/ (e.g. prefix/web01.example.com/mem)
topic_prefix = "devices/testInfluxDB/messages/events/"
##topic_prefix=""
#
# ## QoS policy for messages
# ## The mqtt QoS policy for sending messages.
# ## See https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.dev.doc/q029090_.htm
qos = 2
- As you see, telegraf send this complete topic: “devices/test/testInfluxDB/messages/events/ {blank space}/mqtt_consumer”.
- In next image shows some logging from IoT Hub side, when output MQTT broker is redirected to IoT Hub with SSL considerations. It seems when some message try to arrive, device is disconnected.
UPDATE. It works with following settings
It works, finally.
Changes to make work was removing a simple slash.
If I keep…
[agent]
omit_hostname = true
[[outputs.mqtt]]
"devices/testInfluxDB/messages/events"
Now, it works. Is not valid to put last slash /
On the other hand, I don’t understand that if I put qos=2 that indicates message is delivered exactly once, message is sent a lot of times as shown in screenshot. If qos=1, message arrives exactly once, each time you click publish MQTT button,