Ad Widget

Collapse

Zabbix 7.0 Agent2 MQTT TLS Plugin Problam

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jeffmandel
    Junior Member
    • Jul 2025
    • 2

    #1

    Zabbix 7.0 Agent2 MQTT TLS Plugin Problam

    The Zabbix MQTT TLS configuration process keeps failing. I don't know why.
    Version list
    Ubuntu 24.04.2 LTS
    Zabbix Agent 2 7.0.17
    Zabbix Agent 2 has been running for a long time, and the general snmp data collection is normal.

    MQTTS Status Description:
    1. The MQTT broker is functioning properly. TCP/Firewall is configured correctly.

    Receiver side
    sudo -u mosquitto mosquitto_sub -h 192.168.2.71 -p 8883 --cafile ~/ca.crt -u zabbix_user -P passwd123 -t "test/topic" -v

    Sending Side
    sudo -u mosquitto mosquitto_pub -h 192.168.2.71 -p 8883 --cafile /etc/mosquitto/certs/ca.crt -u zabbix_user -P passwd123 -t "test/topic" -m "Hello, Zabbix!"

    Can be received at the receiving message.
    Client null received PUBLISH (d0, q0, r0, m0, 'test/topic', ... (14 bytes))
    test/topic Hello, Zabbix!

    2. /etc/zabbix/zabbix_agent2.conf add the following
    Plugins.MQTT.Sessions.MQTTsBroker.Url=tls://192.168.2.71:8883
    Plugins.MQTT.Sessions.MQTTsBroker.Topic=test/topic
    Plugins.MQTT.Sessions.MQTTsBroker.TLSCAFile=/etc/zabbix/ca.crt
    Plugins.MQTT.Sessions.MQTTsBroker.User=zabbix_user
    Plugins.MQTT.Sessions.MQTTsBroker.Password=passwd1 23

    3. Permissions
    sudo ls -l /etc/zabbix/ca.crt
    -rw-r--r-- 1 zabbix zabbix 1432 Jul 28 18:50 /etc/zabbix/ca.crt

    4. Zabbix Web adds item 1
    Name:MQTT Test Topic
    Type:Zabbix agent (active)
    Key:mqtt.get["tls://192.168.2.71:8883,test/topic,zabbix_user,iotddcom"]
    Type of information:Text

    log error , /var/log/zabbix/zabbix_server.log
    Invalid first parameter "URL": parse "tls://192.168.2.71:8883,test/topic,zabbix_user,iotddcom": invalid port ":8883,test" after host.

    5. Zabbix Web modify key
    Name:MQTT Test Topic
    Type:Zabbix agent (active)
    Key:mqtt.get[MQTTsBroker]
    Type of information:Text

    log error , /var/log/zabbix/zabbix_server.log
    sudo tail -f /var/log/zabbix/zabbix_server.log | grep mqtt
    2246:20250728:204500.002 In substitute_key_macros_impl() data:'mqtt.get[MQTTsBroker]'
    2246:20250728:204500.002 End of substitute_key_macros_impl():SUCCEED data:'mqtt.get[MQTTsBroker]'
    2246:20250728:204500.003 send_list_of_active_checks_json() sending [{"response":"success","config_revision":470,"da ta" :[{"key":"mqtt.get[MQTTsBroker]","itemid":49191,"delay":"0","lastlogsize":0," mtim e":0,"timeout":"3s"}]}]
    2246:20250728:204505.005 hostid:10658 item mqtt.get[MQTTsBroker] error: open : no such file or directory

    6. Is the zabbix setting#4 and #5 correct?
    7. #5 Which file does "no such file or directory" refer to?

    Thanks.
  • Answer selected by Markku at 30-07-2025, 09:32.
    Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    For number 4 (":8883,test" error), I'd suggest quoting the URL (you have incorrectly quoted everything as one parameter): https://www.zabbix.com/documentation...-quoted-string

    For number 5 (session name), in https://www.zabbix.com/documentation...gent2#mqtt.get there is no "connString" parameter mentioned, so I take it that the MQTT plugin cannot use session name (some other plugins specifically mention "connString = URI or session name", MQTT only says "broker URL").

    Markku
    Last edited by Markku; 29-07-2025, 08:20.

    Comment

    • Markku
      Senior Member
      Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
      • Sep 2018
      • 1781

      #2
      For number 4 (":8883,test" error), I'd suggest quoting the URL (you have incorrectly quoted everything as one parameter): https://www.zabbix.com/documentation...-quoted-string

      For number 5 (session name), in https://www.zabbix.com/documentation...gent2#mqtt.get there is no "connString" parameter mentioned, so I take it that the MQTT plugin cannot use session name (some other plugins specifically mention "connString = URI or session name", MQTT only says "broker URL").

      Markku
      Last edited by Markku; 29-07-2025, 08:20.

      Comment

      • Brambo
        Senior Member
        • Jul 2023
        • 245

        #3
        Is it a typo in your zabbix conf section where the password has a space between 1 and 2?

        Comment

        • jeffmandel
          Junior Member
          • Jul 2025
          • 2

          #4
          Change the key format to the following: mqtt.get["tls://192.168.2.71:8883","test/topic","zabbix_user","passwd123"]
          The system will then accept it.

          Thanks, Markku, for the heads-up.

          Comment

          • cyber
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Dec 2006
            • 4806

            #5
            Originally posted by Brambo
            Is it a typo in your zabbix conf section where the password has a space between 1 and 2?
            Its the forum "feature" to add random spaces in pasted text..

            Comment

            Working...