Ad Widget

Collapse

Macros inheritance, does this always work across linked Templates?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kholliday
    Junior Member
    • Sep 2021
    • 5

    #1

    Macros inheritance, does this always work across linked Templates?

    I am considering the use of Template - IIS by Zabbix agent active, which comes with Zabbix 5.4.
    Some docs indicate that Template macros can be overriden if same-name macro is present on a parent object, such as a linked parent Template or a host. Does that also apply to this particular template?


    If I want to define {$IIS.PORT} and {$IIS.SERVICE} values in the parent Template, should I expect them to propagate down to the actual IIS by Zabbix agent template and override any 'default' values seen there? Or would I have to remove those macros at IIS by Zabbix agent to allow parent values to come down? Descriptions on some macros indicate that they *can* be overrriden, but that's not noted on macros {$IIS.PORT} and {$IIS.SERVICE}.

    When I tried to do this, it seemed inheritance was not working. When I drill down to the IIS by Zabbix agent as child template from a linked parent, it does not seem to show the port and service values (in Inherited and Template macros tab) from macros specified in the parent.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    Such override will work with any template. If you define macro with same name higher in the chain, it will override value from lower in the chain.

    Add a template "Child" with one macro inside called {$MACRO1} and value "child"
    Add another template called "Parent", with one macro {$MACRO1} and value "parent". Link this template to "Child" template.
    Link "Parent" template to a "host". Now if you go to host config and Macros you will see that macro {$MACRO1} has value "parent". So it has effectively overrun the value from "child".
    Last edited by cyber; 27-01-2022, 10:23.

    Comment

    Working...