Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-2738

Template macro precedence

XMLWordPrintable

    • Icon: Change Request Change Request
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • None
    • Server (S)

      I created same contents as ZBX-9386, as a bug. But it looks more suitable to create as a feature request, so I will recreate this issue..

      Zabbix manual explains template macro precedence like below;


      Zabbix substitutes macros according to the following precedence:
      :
      2.macros defined for first level templates of the host (i.e., templates linked directly to the host), sorted by template ID
      3.macros defined for second level templates of the host, sorted by template ID
      4.macros defined for third level templates of the host, sorted by template ID
      5.…
      :


      However, we can't see template IDs on Zabbix UI. so it is difficult to manage macros for users.

      For example, take the following steps;
      1. make a host template "template1", and set template macro "{$TEST}=test1"
      2. make another host template "template2", and set template macro "{$TEST}=test2"
      3. make an item to "item1", which name is "item1 for {$TEST}"
      4. make an item to "item2", which mame is "item2 for {$TEST} 5. link "template1" and "template2" to a host "macrotest"
      6. list the items of "macrotest".

      The item names might be
      "item1 for test1"
      "item2 for test1"
      because template1 is made earlier and its template ID might be smaller than template2's one. But we can't say so exactly because we don't know how Zabbix puts template IDs and can't confirm template IDs on Zabbix UI. So, the names also might be
      "item1 for test2"
      "item2 for test2"

      It is more difficult to manage macros if we don't know the order of making templates. Can you tell me which has smaller ID if we have "Tokyo-template" and "Osaka-template"?

      Therefore, we might not understand macro substitution until we complete Zabbix setting. It is incomvenent.

      The suggestion for substituting template macros is to substitute macros within templates first. In other words, Zabbix substitiutes template macros to the templates' items/triggers first. In the step above, the items names are
      "test1 item for test1", because template1 macro is substituted to item1
      "test2 item for test2", because template2 macro is substituted to item2

      It looks more logical and easier to manage macros.

      Thank you.

            Unassigned Unassigned
            Junichi Junichi Sakuyama
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: