Ad Widget

Collapse

Host port as item key parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JulioQc
    Junior Member
    • Dec 2018
    • 28

    #1

    Host port as item key parameters

    Hi,

    I have about 500 hosts, each with a different service (aka port) to monitor for availability. They don't allow icmp so I have no choice but to use the tcp check.

    Now for a single host I'd go about a simple check with this item
    Code:
    net.tcp.service[tcp,,17256]
    to have the service checked. And it works when I test it.

    With 500 hosts with 95% on different ports, I'm not going to create them manually. You probably see where I'm going. Why can't I use the {HOST.PORT} macro in the item key parameters???

    For example,
    Code:
    net.tcp.service[tcp,,{HOST.PORT}]
    returns "Invalid third parameter".

    Is there any way I can get this working or am I stuck to go spend my weekend configuring 500 hosts one by one? All host have their port configured correctly (changed the default 10050 to whatever is used for monitoring)

    Thank you


  • markfree
    Senior Member
    • Apr 2019
    • 868

    #2
    Zabbix macro documentation states that
    Macros may be used in item key parameters.
    but
    (...) for only a part of the parameter
    I find this information a bit confusing but we can try out.

    Also, doc for macro suggests using something like this:
    item.key[server_{HOST.HOST}_local]
    According to built-in macros documentation, {HOST.PORT} means "Host (agent) port".
    It does not point to a service port.
    Maybe, when creating your host, if you use your service port as "agent" port it might do the trick.
    Also, when setting up the item, the "host interface" must be set up correctly.


    Are you using templates?
    Do your hosts use an zabbix agent or are you only using simple checks?
    How did you set up your hosts interface ports?

    Comment

    • JulioQc
      Junior Member
      • Dec 2018
      • 28

      #3
      Yes I agree, it is confusing.

      Also, this implies it should only work for macros {HOST.*} supported as item key parameters:
      1 The {HOST.*} macros supported in item key parameters will resolve to the interface that is selected for the item.
      Which {HOST.PORT} does not list as supported:
      → Trigger-based notifications and commands
      → Problem update notifications and commands
      → Autoregistration notifications and commands
      → Internal notifications
      → Trigger names, event names, operational data and descriptions
      → Trigger URLs
      → JMX item endpoint field
      → Tag names and values
      (unlike {HOST.CONN} which has it listed as supported)

      And to answer your questions:
      Are you using templates?
      Do your hosts use an zabbix agent or are you only using simple checks?
      How did you set up your hosts interface ports?
      Yes, this is for a template applied to all those hosts.
      A simple check only; one item, one trigger, per host.
      I use the default interface created when you create a new host. I put in the relevant IP and changed the port to whatever is relevant for that host (ie IP:11.22.33.44 DNS:<blank> Connect:IP Port: 8228).

      Comment

      • markfree
        Senior Member
        • Apr 2019
        • 868

        #4
        I tested out here, but didn't work either.
        I guess it is not supported then.

        Hope developers make it available.

        Comment

        • Hamardaban
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • May 2019
          • 2713

          #5
          According to the documentation (what is your version of zabbix?) {HOST.PORT} macro will not work in the key definition.
          I recommend that you do not touch the port settings of the agent interface and do not use them for customization purposes.
          Create a custom macro {$TCPSERVICEPORT} at the template level and use it in the key. For customization, redefine the macro at the host level.

          Comment


          • JulioQc
            JulioQc commented
            Editing a comment
            That's what we did and got an intern to set the macro value for each host for that template
        • Semiadmin
          Senior Member
          • Oct 2014
          • 1625

          #6
          Funny 2 identical questions in 2 days

          Comment


          • Hamardaban
            Hamardaban commented
            Editing a comment
            Many people are confused by the fact that some very similar(!) macros can be used somewhere , but somewhere - no.
            :-) And of course no one reads the documentation!

          • JulioQc
            JulioQc commented
            Editing a comment
            Probably because it would be a useful feature?
        Working...