[ZBXNEXT-7460] Return of {$USER.MACRO} in item PROTOTYPE names. Created: 2022 Feb 01  Updated: 2024 Jun 27  Resolved: 2024 Jan 02

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: API (A), Frontend (F), Server (S)
Affects Version/s: 6.0 (plan)
Fix Version/s: 7.0.0alpha8, 7.0 (plan)

Type: Change Request Priority: Trivial
Reporter: Andrey Tocko (Inactive) Assignee: Vladislavs Sokurenko
Resolution: Fixed Votes: 52
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified
Environment:

Attachments: PNG File image-2022-09-16-07-45-52-397.png     PNG File image-2022-09-16-07-46-19-270.png     PNG File image-2022-09-16-07-46-34-779.png     PNG File image-2022-12-07-23-53-27-689.png     PNG File macromap.PNG     PNG File result.PNG     PNG File screenshot-20220921_090635.png     PNG File screenshot-20220922.png     PNG File screenshot-20220923.png     PNG File screenshot-20220924.png     PNG File screenshot-20220925.png    
Issue Links:
Causes
caused by ZBXNEXT-7115 Drop deprecated support of user macro... Closed
Duplicate
is duplicated by ZBXNEXT-8562 User Macro in Name of Item Closed
Sub-task
Sub-Tasks:
Key
Summary
Type
Status
Assignee
ZBXNEXT-8738 Frontend implementation to support us... Specification change (Sub-task) Closed Andrejs Griščenko  
Epic Link: Zabbix 7.0
Team: Team A
Sprint: Sprint 105 (Oct 2023), Sprint 107 (Dec 2023)
Story Points: 10

 Description   

If possible, change {$USER.MACRO} to be resolved during LLD. Not dropped completely. In this case it won't affect search by item name.

Main use case was mapping of user macroses with context on template/host level to use on discovery phase. In this case {#LLD.MACRO} should be resolved first, then {$USER.MACRO}.

Example of user+lld macro combination:

{$FSDESCR:"{#FSNAME}"} 

Example of mapping:

Example of result after discovery:

Workaround with JS preprocessing is available, but not quite elegant.



 Comments   
Comment by Rodrigo P [ 2022 Sep 16 ]

Hi.

Macros support in item names make totally sense. Below I bring one of the many use cases I have here.

 

We have BGP session monitoring, getting lot of related metrics. In item name, we have context macro that should be resolved for their values.

 

To resolve macro values discovered in LLD rules, we need to replace context macros with desired values we want to be shown in item names.

 

Without macro support in item names, it's not possible to add custom values for items and  context macro values are not resolved, as example below.

 
 

 

Please, consider bringing this feature back.

 

Thanks.

Comment by Josip Deanovic [ 2022 Sep 21 ]

Hello,

 

I am new to Zabbix. I inherited Zabbix 4.0.x installation which makes use of user macros in item names heavily.

This feature makes Zabbix flexible and I am shocked to see that it is not supported in 6.0.x version.

Removing user macros from names of the items (and I assume from triggers and their prototypes as well) calls for a lot of hard coding. Surely, there must be another way to fix whatever issues that feature presented.

Avoiding hard coding and keeping more general item names would produce item names that are not distinguishable between each other. For example, please observe the screenshot of the "Latest data" screen in Zabbix 4.0.x:

I looked all the features in versions 5.0.x and 6.0.x and I find them pretty insignificant in comparison with what 6.0.x lost by dropping user macros from item names and this is really sad.

 

Please, consider bringing this feature back.

Comment by MikolajPorczynski [ 2022 Oct 26 ]

Please, consider bringing this feature back.

Comment by Eugene Mihaylovskiy [ 2022 Dec 07 ]

I have this problem too. Can you return this function
.

Comment by Rodrigo P [ 2023 Mar 26 ]

Hi.
Is there any update on this issue? 

Thanks.

Comment by MikolajPorczynski [ 2023 Jul 19 ]

Is there any plan to restore this feature? We use of USER MACRO everywhere to simplify templates, this issue is blocking any upgrade in my company! Thanks.

Comment by Alexei Vladishev [ 2023 Aug 28 ]

Thanks so much for all your feedback here!

We are introducing support of user macros in item prototype names in Zabbix 7.0. The macros will be expanded during LLD process, therefore item names will not contain user macros.

We will try to backport it to the latest 6.0.x and 6.4.x.

Note that we are not going to introduce support of user macros in item names.

Comment by Constantin Oshmyan [ 2023 Aug 28 ]

alexei, great news, thanks!

Comment by James Cook [ 2023 Aug 29 ]

Hi Alexie,

Only reverting user macros for discovered items solves half the problem, as standard items may also have 'configurable' information in the item name which previously came from user macros.

I raised https://support.zabbix.com/browse/ZBXNEXT-7497 not being aware of this issue.

Here are some examples for standard items from the official Zabbix templates which are still current even on my Zabbix 6.4.4 appliance:

  • Template (IIS by Zabbix agent)
    • Item Name = IIS: {$IIS.PORT} port ping
  • Template ('IIS by Zabbix agent active')
    • Item Name = IIS: {$IIS.PORT} port ping
  • Template (Oracle by ODBC)
    • Item Name = Oracle: Sessions locked over {$ORACLE.SESSION.LOCK.MAX.TIME}s
    • Item Name = Oracle: User '{$ORACLE.USER}' expire password
  • Template (Oracle by Zabbix agent 2)
    • Item Name = Oracle: Sessions locked over {$ORACLE.SESSION.LOCK.MAX.TIME}s

Heres some examples of how we use it:

  • Port monitoring - using the port number in the name.
    • Macro Name = {$APP.POSTGRES.POSTGRESQL.CONF.PORT:"postmaster"}
    • Macro Value = 5432
    • Item Name = Process - Listening {$APP.POSTGRES.POSTGRESQL.CONF.PORT:"postmaster"}/TCP (postmaster)
    • Item Name Displayed = Process - Listening 5432/TCP (postmaster)
  • Logfile monitoring - using the port number in the name.
    • Macro Name = {$OS.SYSTEM_LOGFILE.CONF.PATH:"messages"}
    • Macro Value = /var/log/messages
    • Item Name = System Logfile ({$OS.SYSTEM_LOGFILE.CONF.PATH:"messages"})
    • Item Name Displayed = System Logfile (/var/log/messages)

Please reconsider as standard items and discovered items would be stored in the same tables and are displayed in the same web page etc...

 

Cheers

James

Comment by Dmitry Khenkin [ 2023 Aug 29 ]

I use standard template Oracle by Zabbix agent2, but I cloned it because I have more than 3 Oracle instance on same host.
I need the ability to use custom macros in the names of items, triggers, charts and dashboards. To distinguish the same elements from different clones. 

Please consider returning the opportunity or suggest another method for my problem.

Comment by MikolajPorczynski [ 2023 Aug 29 ]

Unfortunately, the proposed solution does not solve my problem. I need to use user macros in the names of all items - not only in item prototype names.

Comment by Alexei Vladishev [ 2023 Aug 29 ]

The main problem with dynamic item names is that we cannot make reliable and fast search functionality. It is because Zabbix must expand all macros first, which is rather heavy operation. Well, I understand all your use cases and reasonings, but I still do not see how it can be fixed in a good way.

Comment by James Cook [ 2023 Aug 30 ]

Perhaps the same solution for trigger definitions where you have the name and event name?

For items it would be name and item name, where the item name would contain user macros and only be used for display purposes only if specified?

This could also cut down the amount of work when performing substitutions as it would only occur on the item name field if specified.

Comment by MikolajPorczynski [ 2023 Sep 05 ]


Alexei, I understand your point of view. On my part, it's more important to maintain the functionality that has been available in Zabbix for many years. Maybe you could give users a choice whether to resolve macros or not - with the information that it may affect search performance. This option should be disabled by default for new installations. The ability to use custom macros in the names of items is for me more critical that search performance. Thanks!

Comment by Alexei Vladishev [ 2023 Sep 05 ]

[email protected], indeed, one of possible solutions is to have some sort of technical (configuration) and visible (what end-users see) item names. In this case Zabbix Server should update visible names any time a technical name or some user macro changes its value. It is doable, but it is not clear what performance hit it may cause.

MikolajPorczynski, totally agree. We are still looking for a practical way of solving this.

Comment by Alexei Vladishev [ 2023 Oct 06 ]

All right, we are implementing support of user macros in item and item prototype names in Zabbix 7.0. Thanks again everyone for your valuable feedback, especially for describing various use cases.

Comment by MikolajPorczynski [ 2023 Oct 06 ]

Alexei, great news! Thank You!

Comment by Josip Deanovic [ 2023 Oct 06 ]

Great news indeed. Thank you!

Comment by Constantin Oshmyan [ 2023 Oct 09 ]

alexei, great news, thank you!
Will it be implemented in the frame of this (current) ZBXNEXT? If not, it's valuable to link new ZBX/ZBXNEXT to this one.

Comment by Alexei Vladishev [ 2023 Oct 10 ]

constantin.oshmyan, it all will be implemented under this ticket.

Comment by Dmitrijs Goloscapovs [ 2023 Nov 23 ]

Available in versions:

Comment by Martins Valkovskis [ 2023 Dec 01 ]

Updated documentation:

Comment by Mickael Martin [ 2024 Jan 30 ]

Thank you very much!

Generated at Sat Mar 29 06:01:37 EET 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.