Ad Widget

Collapse

Linked Templates Item structure issue when using Macros

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mephage
    Junior Member
    • May 2013
    • 5

    #1

    Linked Templates Item structure issue when using Macros

    I am attempting to monitor multiple environments with multiple instances containing multiple web applications run accross multiple hosts (sounds ridiculous on paper but it's actually very practical). The web apps can be on different hosts depending on how we choose to setup any given instance in a certain environment. I have tried to use a combination of Templates, Items, Triggers and Macros to accomplish this in the best possible way, however I have run in to an issue with the setup:

    Please review the textual diagram of the Template setup in the following post and the review the following notes:


    When I apply Template_web1 to my host 'hosta' it works well. The items are applied with the correct macros referenced and the triggers work when they should.
    The problem occurs when I try to apply Template_web2 to 'hosta'. I get an error stating that the item(s) already exist(s) on the host.
    It appears that rather than checking against the item name/key after the macros are substituted, it refers to the macro references as literal strings and therefore believes that I'm trying to add the same item to 'hosta' when obviously it is configured uniquely.

    Has anybody experienced this drawback of Zabbix and if so what was the workaround?

    Manually adding the same Items to each Template_webX is not really a scalable and time-efficient solution. I'd like to avoid it at all costs. Especially considering how many instances of this same scenario exist in our multiple environments.

    I can provide more information if necessary.
  • Heilig
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2013
    • 366

    #2
    The key must be unique.
    Please show the key from Template_web1 and Template_web2 by adding which you get an error in zabbix.

    Comment

    • mephage
      Junior Member
      • May 2013
      • 5

      #3
      Textual Diagram

      Template_web_generic
      |- Items:
      |-- Name: {$WEB_NAME} is listening on ${WEB_IP}:{$WEB_PORT}
      |--- Key: net.tcp.port[{$WEB_IP},{$WEB_PORT}]
      |-- Name: {$WEB_NAME} process exists
      |--- Key: proc.num[,,,{$WEB_NAME}]

      |- Triggers:
      |-- Item1Trigger (a trigger that uses to the first item)
      |-- Item2Trigger (a trigger that uses to the second item)

      Comment

      • mephage
        Junior Member
        • May 2013
        • 5

        #4
        Textual Diagram #2

        Template_web1
        |- Macros:
        |-- {$WEB_IP} = 127.0.0.1
        |-- {$WEB_PORT} = 5001
        |-- {$WEB_NAME} = web1

        |- No Items or triggers are configured for Template_web1

        Template_web_generic is linked under this Template_web1 template.

        Template_web2
        |- Macros:
        |-- {$WEB_IP} = 127.0.0.1
        |-- {$WEB_PORT} = 5002
        |-- {$WEB_NAME} = web2

        |- No Items or triggers are configured for Template_web2

        Template_web_generic is linked under this Template_web2 template.

        Comment

        • neogan
          Senior Member
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Sep 2011
          • 118

          #5
          I think you should use different macros for templates for the same host.

          You have error because keys is similar, I suppose macroses have not been replaced yet.

          Comment

          • mephage
            Junior Member
            • May 2013
            • 5

            #6
            Obviously there is no workaround except to manually create the same item for each Template_webX using unique Macro names for each of the Template_webX services. I then configure the Macros for each template on the host. I may as well give up on using Macros altogether because the Macro values are only used a few times for each template making it almost easier to hard code them. It seems to be a huge flaw in the scalability of Template setup and Macro use.

            I have however created a script to manage the Templates once exported as .xml files. Not the way I'd like to do it but it works for now. It'd be great to see this fixed in future.

            Comment

            Working...