Ad Widget

Collapse

Discovery question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • G0nz0uk
    Member
    • Apr 2021
    • 54

    #1

    Discovery question

    Hello,

    I have 2 templates I'm working on.

    Template A - General SNMP stuff. Works on all devices.
    Template B - Reads a local json file for some extra metrics.

    These 'extra' metrics via the json file the Template B looks for are not on all the devices, over time it will though. I wanted to link Template B to A, but I realise it's not best way possibly as Zabbix will run Template A on many devices where Template B won't work. Is there a way I can get Template B to discovery if the JSON file exists first then process with the rest of the template?

    The URL is http://{HOST.IP}//metrics.json

    I did wonder if I could check if port 80/443 is responding then treat that as ok too.

    Any ideas would be great

    I'm using Netbox to Sync with Zabbix, in Netbox I can only assign the one template (atm), so I wondered how I can assign 2 templates instead, so I thought I could just keep the same template name which is Template A and just link B to it, job done.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4851

    #2
    Discovery allows to define extra checks.

    Click image for larger version

Name:	image.png
Views:	48
Size:	4.9 KB
ID:	510300
    and add additional disocvery action based on that result...

    Comment

    • G0nz0uk
      Member
      • Apr 2021
      • 54

      #3
      Thankscyber

      I think I'm confusing myself on getting this discovery working. So I have the template working just great if I assign to a host device that is running http://{HOST.IP}/v0/metrics.json

      As you can see on the template below I have no discovery yet:

      Click image for larger version

Name:	image.png
Views:	46
Size:	102.6 KB
ID:	510414I want to get it to to discover http://{HOST.IP}/pod/v0/metrics.json first then if it finds it run through the items of not then skip this template on that host.

      What would the discovery section look like for this please?

      Looking at your screenshot I can't tell how you get to that 'check' section.

      Thanks

      Comment

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

        #4
        Eeeeh... My screenshot is from network discovery... Not from discovery section of template... So disregard my answer...

        I don't know how many devices you have and how often you need to manage this, but you can still link template B. Just disable everything in template and if you have added a host, go and enable required stuff on host directly.

        Comment

        • G0nz0uk
          Member
          • Apr 2021
          • 54

          #5
          Instead of linking, in the discovery is there a simple way just to look to see if the remove host device has port 80 open and if so then proceed to run the template against it? We will have about 5k of devices in the end that 'could' have this json http url that I can successfully scrape details from.

          Comment

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

            #6
            Discovery there, in template, does not do pre-checks..
            You can have a port check in template A and trigger on top of it.. Then create an action based on that trigger, which in background assigns that other template B over the API to a host. and then disables the item in temaplte A, so it would not spam.

            Comment

            Working...