Ad Widget

Collapse

Using HOST.IP and HOST.PORT with modebus_read item key

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • knez
    Member
    • Dec 2019
    • 44

    #1

    Using HOST.IP and HOST.PORT with modebus_read item key

    Hey,

    I would be grateful for some help with working with ModBus Hosts/Items.

    After I created an Item in Host and Key of that Item that looks like

    Code:
    modbus_read[{$HOST.IP}:{$HOST.PORT},1,25,4,uint16]
    I get an error message: Not Supported: Network is unreachable.

    Zabbix documentation says:
    2 The {HOST.*} macros supported in item key parameters will resolve to the interface that is selected for the item. When used in items without interfaces they will resolve to either the Zabbix agent, SNMP, JMX or IPMI interface of the host in this order of priority, since Zabbix 3.0.6.
    My Item inherited the Host's IP and PORT:
    Click image for larger version

Name:	Untitled.png
Views:	7751
Size:	102.6 KB
ID:	392019

    When I put the IP address instead of macros:

    Code:
    modbus_read[tcp://192.168.139.38:502,1,25,4,uint16]
    I receive the correct value of register 25.
    Attached Files
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2

    According documentation {HOST.PORT} not supported in item key.
    Last edited by Hamardaban; 20-12-2019, 13:17.

    Comment

    • knez
      Member
      • Dec 2019
      • 44

      #3
      Thank you!

      Comment

      • dimir
        Zabbix developer
        • Apr 2011
        • 1080

        #4
        Let's not confuse 2 things there:
        • built-in macros (e. g. {HOST.HOST})
        • user macros (e. g. {$HOST.HOST})
        In the macros of your item key you have the dollar sign, which means that is a user macro. User macros are supported in item key parameters but they need to be defined somewhere (on a host, its template or globally): https://www.zabbix.com/documentation...ros/usermacros . So if you define them, you will be good. Currently, if not defined, they will be left as is and since they are neither address nor port the metric will fail.

        If you would like to use build-in macros, as Hamardaban said, {HOST.HOST} is supported in item key parameters and {HOST.PORT} is not. See this page for list of build-in macros and where they are supported: https://www.zabbix.com/documentation...ed_by_location

        Comment


        • Hamardaban
          Hamardaban commented
          Editing a comment
          My mistake! of course I meant the built-in macro...
      • knez
        Member
        • Dec 2019
        • 44

        #5
        Thank You, both! I'm just learning Zabbix, and this help means much to me.

        Comment

        Working...