[ZBXNEXT-1568] Recursive macro resolution Created: 2013 Jan 13 Updated: 2024 Jun 19 |
|
Status: | Open |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Server (S) |
Affects Version/s: | 2.0.4 |
Fix Version/s: | None |
Type: | Change Request | Priority: | Trivial |
Reporter: | Enrico Tröger | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 29 |
Labels: | macro, template | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Issue Links: |
|
Description |
It would be really nice if one could use macros as values for other macros. In detail, I want to define a template macro {$SSH.IP} with a default value {HOST.IP1} on the template. Currently, the template macro value {HOST.IP1} is not resolved and passed directly to the item, which obviously fails. So, for now, I had to define the {$SSH.IP} macro on each of my hosts to get the item working. |
Comments |
Comment by Marc [ 2016 Aug 08 ] |
|
Comment by Sandis Neilands (Inactive) [ 2016 Oct 06 ] |
The risk here is obviously with user macros that resolve to themselves. Note that such recursion might not be direct. Another difficulty could be with the implicit unquoting. |
Comment by Alex Tomasello [ 2018 Jul 11 ] |
I think that you can use zabbix macros as value of user macro. I think in this case, you can prevent loop in recursion. What do you think about? |
Comment by Marco Hofmann [ 2019 Feb 25 ] |
I tried the same today, with the "Template Virt VMware" where you have to define "{$URL}" on host level to resolve to "https://1.2.3.4/sdk". Now I thought I'm smart like @eht16 and resolve "{$URL}" to "https://{HOST.IP}/sdk" on template level. But sadly that won't resolve. Are there any plans to change the behavior of Zabbix in this way? Until then I have to set "{$URL}" on each and every host manually :-/ |
Comment by Vadims Kurmis [ 2019 Aug 14 ] |
I want to use "{$URL}" = "https://{HOST.IP}/SDK" for my VMware ESX Template. Zabbix should include nested macro support. This is very flexible and wanted functionality. Grafana supports nested macros. This is a common thing for templating. And if Zabbix is based on templates, then should not cut down all the flexibility, if properly made recursion checks.
|
Comment by Jim [ 2019 Nov 11 ] |
This feature would be really useful for me as well. |
Comment by Aleksandrs Petrovs-Gavrilovs [ 2022 Mar 24 ] |
It would be even better if we could pass LLD macro behind a user macro, for a greater host level LLD flexibility. |
Comment by Matthew Steeves [ 2024 Apr 15 ] |
My use case is: {$SPECIAL.1} = asdf {$SPECIAL.2} = qwerty {$REGEX_ALL} = {$SPECIAL.1}|{$SPECIAL.2} {$REGEX_ALL} would be used within a trigger expression in a trigger prototype.
|
Comment by Nilesh Gupta [ 2024 Jun 19 ] |
This feature would be really useful for me as well. |