[ZBXNEXT-2297] Add macro creation/edition for host prototypes Created: 2014 May 13  Updated: 2024 Apr 10  Resolved: 2020 Apr 28

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Frontend (F), Server (S), Templates (T)
Affects Version/s: 2.2.3
Fix Version/s: 5.0.0beta1, 5.0 (plan)

Type: New Feature Request Priority: Major
Reporter: Julien Leloup Assignee: Gregory Chalenko
Resolution: Fixed Votes: 62
Labels: lld, macros, templates
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Selection_227.png     XML File zbx_export_templates.xml    
Issue Links:
Causes
causes ZBX-17655 Use of unitialized variable when link... Closed
causes ZBX-18174 Host macro updates when linking templ... Closed
Duplicate
is duplicated by ZBXNEXT-2690 Host Prototype Macros Closed
is duplicated by ZBXNEXT-2605 LLD Host prototype: create user macro... Closed
is duplicated by ZBXNEXT-2734 Support configurable User Macros Closed
Sub-task
Team: Team D
Sprint: Sprint 62 (Mar 2020), Sprint 63 (Apr 2020)
Story Points: 3

 Description   

Having the capability to create user-defined macros when defining a host prototype can be really useful in order pass values to this host that where only available in the LLD context, like {#SNMPINDEX} or {#SNMPVALUE}.

Example : by creating a user-defined macros with the values of {#SNMPINDEX} on an host prototypes with a template attached, one can implement a LLD discovering sub-parts of an SNMP-enabled host (Power Supplys, Blades on a chassis, etc...) which then creates full-fledged hosts representing these sub-parts of the original host.
Then these hosts can have items requesting OIDs relevant to them, by using the attached template with items refering to the user-defined macros storing the {#SNMPINDEX} found during the LLD.



 Comments   
Comment by Julien Leloup [ 2014 May 15 ]

Also for this feature to work, user-defined macros values should be filled with the value of another macro, like {#SNMPINDEX}.

Comment by Marc [ 2014 May 22 ]

If I'm not wrong it might be similar to ZBXNEXT-2026

Comment by Julien Leloup [ 2014 May 28 ]

It seems ZBXNEXT-2026 does ask for the same kind of feature to achieve another goal.

But only having ZBXNEXT-2026 won't be enough to fill the scenario I proposed : the capability to discover hosts from a single SNMP agents and attach non-generic items to them (items which needs the SNMP index that have lead to the host creation through the host prototype).

To do this I believe we need to :

  • have a way to store in the host "context" the value of either {#SNMPVALUE} or {#SNMPINDEX}
    • user-defined macros in host prototypes seems to be a good way to do this but it also requires Zabbix to allow a user-defined macro to get it's value from another macro
    • maybe a way to access {#SNMPINDEX} and {#SNMPVALUE} in items defined in a template which then will be applied to a host created through Host Prototype (seems twisted) ?
  • use this user-defined macros to finally get items specifically requesting OIDs based on what {#SNMPVALUE} or {#SNMPINDEX} was discovered for an host discovered through LLD
    • maybe using the user-defined macros in the SNMP OID filed of an item created in a template applied to the host
    • maybe allowing user-defined macros in the "filter" field of an LLD : this will allows users to define a second LLD in charge of creating items for this host by filtering an SNMP table using the user-definhed macros

Sorry for the headache but I think this kind of scenario is missing for Zabbix right now and it can greatly improve the useability of Host Prototypes.

Comment by Glebs Ivanovskis (Inactive) [ 2018 Jan 09 ]

When counting votes on this feature request please consider duplicates.

Comment by Steffen Höhne [ 2018 Dec 07 ]

would still be great to have this feature!

Thank you!

Comment by Nikolai Djilinski [ 2019 Nov 27 ]

+1 for this feature.

Use cases:

As result of LLD discovery we create the host and pass the LLD macro(s) to new created host (where LLD macros are treated as custom ones). in this case, those macros might be used for items config (key name, http url query etc.).
Having just 2 macros passed - HOST.HOST and HOST.NAME - is not enough. sometimes, discovered LLD macro used for lld host name - might duplicate with different one (discovered earlier - from different monitored object).

Comment by Alexei Vladishev [ 2020 Feb 20 ]

This functionality can be used for a number of useful use cases. I have included it into the roadmap, it will be implemented in Zabbix 5.2 or 5.0 (less likely).

Comment by Michael Veksler [ 2020 Apr 09 ]

Available in:

Documentation updated:

Generated at Thu Apr 24 07:12:35 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.