[ZBXNEXT-1667] support lld macros in trigger function parameters Created: 2013 Mar 14 Updated: 2024 Apr 10 Resolved: 2017 Dec 10 |
|
Status: | Closed |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Frontend (F), Server (S) |
Affects Version/s: | None |
Fix Version/s: | 3.4.0alpha1, 4.0 (plan) |
Type: | Change Request | Priority: | Minor |
Reporter: | richlv | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 16 |
Labels: | lld, triggers | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Issue Links: |
|
||||||||||||||||
Team: | Team A | ||||||||||||||||
Sprint: | Sprint 21, Sprint 22 | ||||||||||||||||
Story Points: | 0.25 |
Description |
usermacros are supported in trigger expression as constants and also in function parameters. would be great to have lld macro support on the same level as usermacro support for trigger expressions |
Comments |
Comment by Chris Christensen [ 2014 May 30 ] |
Agreed; this was confirmed (and was expected to work / principle of least surprise): {#ALERT.MEMORY.HEAP_SIZE.THRESHOLD.PERCENT} = 10 does not work: {template_name:memory-usage-heap-percent[{#JMX.PORT}].count(#3,{#ALERT.MEMORY.HEAP_SIZE.THRESHOLD.PERCENT},"gt")}=3 but works: {template_name:memory-usage-heap-percent[{#JMX.PORT}].count(#3,10,"gt")}=3 |
Comment by Fernando [ 2015 May 21 ] |
Hi All, is there a workaround for a trigger prototype like this? {xx:system.run[zabbix_check_script.pl -qn=fakeA -qm=fakeB -qma=fakeB -qmp=fakeC -qc=fakeD -mqu=",wait].count(#3,{#DEFAULT_WARN},"gt")}>2 |
Comment by Dmitry Verkhoturov [ 2015 Aug 31 ] |
Workaround. This does not work: Task_discovery:exit_status.[{#TASK}].nodata([{#PERIOD}])}=1 This works (but ugly as hell): ({Task_discovery:exit_status.[{#TASK}].nodata(300)}=1 & {#PERIOD} = 5) | ({Task_discovery:exit_status.[{#TASK}].nodata(600)}=1 & {#PERIOD} = 10) | ({Task_discovery:exit_status.[{#TASK}].nodata(900)}=1 & {#PERIOD} = 15) | ({Task_discovery:exit_status.[{#TASK}].nodata(1800)}=1 & {#PERIOD} = 30) | ({Task_discovery:exit_status.[{#TASK}].nodata(2700)}=1 & {#PERIOD} = 45) | ({Task_discovery:exit_status.[{#TASK}].nodata(3600)}=1 & {#PERIOD} = 60) |
Comment by Glebs Ivanovskis (Inactive) [ 2016 Sep 13 ] |
Hm, it seems that in calculated items LLD macros are supported in function parameters... |
Comment by Vladislavs Sokurenko [ 2016 Nov 15 ] |
Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-1667 |
Comment by Vladislavs Sokurenko [ 2016 Nov 15 ] |
(1) Support LLD macros in function parameters of expression, in trigger prototype. wiper CLOSED |
Comment by Vladislavs Sokurenko [ 2016 Nov 15 ] |
(2) Extract different patterns from item values for LLD trigger prototype names, descriptions and tags Use {{ITEM.VALUE}.regsub({#LLD_REGEXP}, {#LLD_PATTERN})} or similar expressions in trigger name, description and tags vso RESOLVED in r63823 wiper CLOSED |
Comment by Vladislavs Sokurenko [ 2016 Nov 15 ] |
(3) Substitute LLD macros in trigger function parameters within simple macros ({host:item[…].func(…)}) in fields which support them (graph prototype names) wiper CLOSED |
Comment by Vladislavs Sokurenko [ 2016 Nov 17 ] |
Server side fixed in development branch: svn://svn.zabbix.com/branches/dev/branches/dev/ZBXNEXT-1667 |
Comment by Ivo Kurzemnieks [ 2016 Nov 21 ] |
(4) [F] Added support for LLD macros in trigger prototypes in r63874 sasha added unit tests in r64048 CLOSED |
Comment by Andris Zeila [ 2016 Nov 22 ] |
(5) [S] Unrelated to the new development, but it appears that the check: if ('{' != *pr++) return FAIL; In src/libs/zbxserver/expression.c:process_simple_macro_token() is unnecessary. This function is called when a simple macro is found at the token token, so '{' will be always at the left token position. vso RESOLVED in r63941 wiper CLOSED |
Comment by Andris Zeila [ 2016 Nov 22 ] |
(6) [S] The zbx_function_param_parse() function expects null terminated parameter list. When parsing an expression containing mulitple functions the caller has to force null termination, call zbx_function_param_parse() function and then restore the original string. To simplify it the zbx_function_param_parse() function must be changed to use parameter length instead of checking for terminating zero. wiper If zbx_function_param_parse() does not return error on validation failure and the expression passed to it is always prevalidated, then we can revert the changes and simply add checking for ')' when parsing unquoted parameter. Something like: for (ptr = expr; '\0' != *ptr && ')' != *ptr && ',' != *ptr; ptr++) ; However we need to add to function comments, that expression must contain valid parameter list. REOPENED vso RESOLVED in r64006 wiper CLOSED |
Comment by Andris Zeila [ 2016 Nov 22 ] |
(7) [S] zbx_function_param_parse() function that is used as basis for substitute_function_parameters() expects valid function parameter list. This means we should either validate function parameters in lld_parameter_make() or change zbx_function_param_parse() to return parsing error (this might be done with (6) subissue ). vso RESOLVED in r63938 wiper CLOSED |
Comment by Andris Zeila [ 2016 Nov 22 ] |
(8) [S] If validation is added to zbx_function_param_parse(), then it woud make sense to rewrite function_match_parenthesis() function to reuse zbx_function_param_parse() instead of manually parsing the parameter list. vso RESOLVED in r63938 wiper As the zbx_function_param_parse() was not reused parenthesis matching, this looks like WONTFIX |
Comment by Andris Zeila [ 2016 Nov 22 ] |
(9) [S] Coding style - would be good to change function names to reflect that lld macros are being subtituted. Something like substitute_function_lld_macros, substitute_parameter_lld_macros. vso RESOLVED in r63940 wiper CLOSED |
Comment by Andris Zeila [ 2016 Nov 24 ] |
(10) lld_parameter_make() will not allocate empty parameter strings, resulting in crash later when prototype parameter is compared to existing parameter in lld_function_make@1100:
if (0 != strcmp(function->parameter, proto_parameter))
{
function->parameter_orig = function->parameter;
function->parameter = proto_parameter;
proto_parameter = NULL;
function->flags |= ZBX_FLAG_LLD_FUNCTION_UPDATE_PARAMETER;
}
vso RESOLVED in r64009 wiper CLOSED |
Comment by Andris Zeila [ 2016 Nov 25 ] |
Server side tested, please review fixed/added comments in r64041 |
Comment by Vladislavs Sokurenko [ 2016 Nov 25 ] |
Fixed in: |
Comment by Vladislavs Sokurenko [ 2016 Nov 25 ] |
(11) [D] Documentation shall be changed to reflect that we added support of LLD macros in function parameters of trigger prototype expression, name, description and tags, and in function parameters of graph prototype name. wiper Documentation updates must be done in:
vso RESOLVED
wiper CLOSED |
Comment by Vladislavs Sokurenko [ 2016 Nov 30 ] |
(12) Update Changelog with a better description of changes vso RESOLVED sasha CLOSED with small fix in r64148 |
Comment by Vladislavs Sokurenko [ 2016 Nov 30 ] |
(13) Update what's new to similar description as change log. sasha CLOSED |
Comment by Oleksii Zagorskyi [ 2017 Nov 21 ] |
(14) [D] looks like we forgot to delete a note bottom of this page https://www.zabbix.com/documentation/3.4/manual/discovery/low_level_discovery ? natalja.cernohajeva : Thank you for finding this. The note is now removed. Please, take a look. |