[ZBX-5832] Allow macros to be escaped within item key parameters Created: 2012 Nov 08  Updated: 2017 May 30  Resolved: 2013 Dec 11

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 2.0.3
Fix Version/s: None

Type: Incident report Priority: Minor
Reporter: Marc Assignee: Unassigned
Resolution: Duplicate Votes: 2
Labels: aggregate, calculation, escaping, macros, substitution
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux, CentOS-6, PostgreSQL 9.1.4, Apache HTTPD-2.2.15, PHP-5.3.3


Issue Links:
Duplicate
duplicates ZBX-2866 nested aggregation function do not es... Closed

 Description   

Please provide a way to avoid the substitution of macros within an item key definition.

For example:
Macro: {$USER_MACRO}=>bar
Item key: foo["{$USER_MACRO}"]

can not be referenced correctly in items of type "Zabbix aggregate".
I tried it in several ways without success:
grpsum["Example Group","foo[\"{$USER_MACRO}\"]",last,0] --> foo["bar"]
grpsum["Example Group","foo[\"{\$USER_MACRO}\"]",last,0] --> foo["{\$USER_MACRO}"]
grpsum["Example Group","foo[\"{$$USER_MACRO}\"]",last,0] --> foo["{$$USER_MACRO}"]
grpsum["Example Group","foo[\"\{$USER_MACRO\}\"]",last,0] --> foo["\{$USER_MACRO\}"]

And if I haven't overlooked something in the source code such a behavior is actually not implemented.

The only way to work-around this issue was adding another user macro which is set to the origin user macro definition and use this instead:
Macro: {$USER_MACRO}=>bar
Macro: {$USER_MACRO_BAR}=>{$USER_MACRO}
Item (Zabbix aggregate): grpsum["Example Group","foo[\"{$USER_MACRO_BAR}\"]",last,0] => foo["bar"]



 Comments   
Comment by Marc [ 2012 Nov 08 ]

Typo - the last line should look like this
Item (Zabbix aggregate): grpsum["Example Group","foo[\"{$USER_MACRO_BAR}\"]",last,0] => foo["{$USER_MACRO}"]

Comment by Marc [ 2013 Mar 23 ]

I'm not sure but ZBX-2866 might point to a similar direction.

Generated at Sat Apr 27 07:01:33 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.