[ZBXNEXT-1982] Expand macros in user macros Created: 2013 Oct 25  Updated: 2016 Aug 08  Resolved: 2016 Aug 08

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Server (S)
Affects Version/s: 2.0.9
Fix Version/s: None

Type: New Feature Request Priority: Trivial
Reporter: Dmitry Samsonov Assignee: Unassigned
Resolution: Duplicate Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates ZBXNEXT-1568 Recursive macro resolution Open

 Description   

Expanding macros in user macros in template will allow to make host level decisions on what value to use.
For example if we have template with item with parameter using {$VHOST}={HOST.DNS}, then we could on host level override it with {$VHOST}="mydomain.com".



 Comments   
Comment by richlv [ 2013 Oct 25 ]

this might be problematic - usermacro and various macro expansion is supported in all kinds of different places

Comment by Dmitry Samsonov [ 2013 Oct 25 ]

Didn't understand why this might be problematic.
Expansion should be made only in user macros.

Comment by richlv [ 2013 Oct 26 ]

user macros can be used in various contexts where other macros may or may not be valid. i suspect the logic might be hard to explain.

Comment by Janne Korkkula [ 2014 Nov 13 ]

This should just work - that's the only logical logic. If the final context is invalid, it's an user/admin error, just as if an invalid macro were used elsewhere - not a problem.

It would be convenient to specify {$CHECK_HOST} = {HOST.NAME} in a template and then {$CHECK_HOST} = service.cname.tld in a host macro to override the default.

The case where I hit this problem uses an external script, so I fixed this with feeding the script both {$CHECK_HOST} and {HOST.NAME} and testing for a non-empty value of {$CHECK_HOST} in the script itself, but this is an unnecessary kludge and only valid for external scripts etc.

Comment by Aleksandrs Saveljevs [ 2016 Aug 08 ]

Looks like a duplicate of ZBXNEXT-1568, closing.

Generated at Fri Apr 11 09:07:03 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.