Ad Widget

Collapse

macro for 1st/2nd/.../Nth Zabbix agent address?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #1

    macro for 1st/2nd/.../Nth Zabbix agent address?

    I have a couple years experience with Zabbix, but after spending some time reviewing the pre-defined macros, I'm wondering if there's any way to do what I'm trying.

    Many of our systems have dual NICs, on separate networks. When we configure an "Agent interface" for a host, are there predefined macros or some other convenient way to reference the 2nd or 3rd or Nth DNS name that is defined for a client via the "Agent interface"?

    I had initially thought that {HOST.DNS2} would be it, but that appears to be defined based on presence in a trigger, not whether a particular client has 2 or 3 or more Zabbix agent interfaces defined.

    So, is there any pre-defined macro that would give me values for the 2nd, 3rd, etc. Zabbix agent interfaces? We really don't want to have to define a user macro that maps to the 2nd interface's DNS name for each and every one of our hosts. Zabbix already has the data, I just can't figure out if it's exposing it for use in items or triggers.

    Thanks,

    Tim
  • gleepwurp
    Senior Member
    • Mar 2014
    • 119

    #2
    Hi Tim,

    Don't you have to specify the interface to use in the item? IE: You specify which interface to use in the item's definition (Host Interface field). Then using the {HOST.DNS1} would plug in that Host Interface's DNS name. (You'd basically have to define the same item for each interface).

    The issue I see is if you want to collect the same "key" on 2 different interfaces, the system won't allow you to define the same "key" twice on the same host, even if the interface is different. You might get away with it if you can make the "key" different, without affecting its function.

    Hope I'm making some sense and this helps in some way.

    G.

    Comment

    • tim.mooney
      Senior Member
      • Dec 2012
      • 1427

      #3
      Originally posted by gleepwurp
      Hi Tim,

      Don't you have to specify the interface to use in the item? IE: You specify which interface to use in the item's definition (Host Interface field). Then using the {HOST.DNS1} would plug in that Host Interface's DNS name. (You'd basically have to define the same item for each interface).
      G.
      Your have to specify the interface for an item only if you're planning on using a "Zabbix agent" item. What we were hoping to do, though, was set up a second DNS agent address for a bunch of our hosts, but then reference that via some kind of pre-defined macro from an icmpping item. The icmpping/icmppingloss items are not Zabbix agent items.

      We would like to create a template that we can just apply to our subset of hosts that have this second NIC, and have the item & trigger in the template reference this second DNS address automatically, without having to set a user macro for each and every host.

      Hopefully that clears up why we're asking about this.

      Tim

      Comment

      • gleepwurp
        Senior Member
        • Mar 2014
        • 119

        #4
        Hi Tim,

        yeah, I agree, my idea would not work on Simple Check items...

        The only options I see would be to either:

        1- use the "system.run" Agent item to run a "ping" using that DNS macro (would be toggled by the "interface" selector I was mentioning),
        Code:
        system.run[ping -c 1 {HOST.DNS1}]
        2- or with a UserParameter defined on the Zabbix Agent, which would again rely on the "Interface" selector, since they're both Zabbix Agent items.
        Userparameter conf file:
        Code:
         UserParameter=ping.dns[*], ping -c 1 $1
        Zabbix Item key:
        Code:
        ping.dns[{HOST.DNS1}]

        The first option would not work if you don't have the "EnableRemoteCommands=1" option set on the agent.

        second option requires that the userparameter line be inserted in a .conf file under zabbix_agentd.d dir.

        Unfortunately, I don't really have anything more elegant to suggest...

        G.

        Comment

        Working...