Ad Widget

Collapse

Add arbitrary label to host discovery name prototype

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • troffasky
    Senior Member
    • Jul 2008
    • 565

    #1

    Add arbitrary label to host discovery name prototype

    I am using a template which discovers Unifi devices from Unifi server with Unifi API. Unifi devices in Unifi are organised by site, of which we have 30 [on this first instance I am testing with].

    This is the template I am working with:



    The issue I have is that Unifi devices do not necessarily have a globally unique name; they only have to be unique per site, so lots of "AP1", "AP2", "Switch 1", etc. The template is applied to Unifi per-site [this is fine, I don't want everything discovered], so there should be an opportunity here to insert a label in to the host names.

    What I have tried so far:
    - Set a macro on the parent host {$UNIFI.SITENAME}, and include this in the host visible name prototype. The macro is inherited by the created hosts [great!] but not resolved [boo] .
    - Edit the hostname prototype on the parent host. Not possible, it's greyed out.

    How can I achieve this?
  • troffasky
    Senior Member
    • Jul 2008
    • 565

    #2
    It seems like anything potentially usable for this [user macros, tags] is not accessible in a way that it can be used in the hostname, even with Javascript preprocessing. Annoying.

    Comment

    • troffasky
      Senior Member
      • Jul 2008
      • 565

      #3
      I have been reduced to cloning the hosts created by LLD so I can give them sensible names, then disabling the LLD rule.

      Comment

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

        #4
        I'm pretty sure you should be able to take that user macro and push it into that json (returned from unifi) as new key-value pair... so you can later point a LLD macro to it...
        Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more.

        Comment

        • troffasky
          Senior Member
          • Jul 2008
          • 565

          #5
          If I have to edit the item to add this usermacro, that means it can't be templated :-/

          Comment

          Working...