[ZBX-9643] $1 macro in trigger description doesn't expand user macro for {TRIGGER.NAME} in action message Created: 2015 Jun 16  Updated: 2017 May 30  Resolved: 2015 Nov 19

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Documentation (D), Server (S)
Affects Version/s: 2.2.9
Fix Version/s: 2.2.12rc1, 2.4.8rc1, 3.0.0alpha5

Type: Incident report Priority: Minor
Reporter: Kodai Terashima Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: macro, trigger, usermacros
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

$1 macro in trigger description can be used to refer to constant of trigger expression.
It works if the constant is fixed value, but it doesn't work with user defined macro for {TRIGGER.NAME} in action message

This works as expected:

Trigger description: CPU user time is more than $1%
Trigger expression: {hostname:system.cpu.util[,user]}>50
Result of {TTIGGER.NAME} in action: CPU user time is more than 50%

This also works as expected:

Trigger description: CPU user time is more than {$CPU_LIMIT}%
Trigger expression: {hostname:system.cpu.util[,user]}>{$CPU_LIMIT}
Result of {TTIGGER.NAME} in action: CPU user time is more than 50%

This doens't work:

Trigger description: CPU user time is more than $1%
Trigger expression: {hostname:system.cpu.util[,user]}>{$CPU_LIMIT}
Result of {TTIGGER.NAME} in action: CPU user time is more than %


 Comments   
Comment by Viktors Tjarve [ 2015 Sep 10 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-9796 r55514

Comment by Andris Zeila [ 2015 Sep 29 ]

Successfully tested. Please review formatting fixes in r55844.

viktors.tjarve Formatting fixes accepted.

Comment by Viktors Tjarve [ 2015 Oct 02 ]

Released in:

  • pre-2.2.11rc1 r55916
  • pre-2.4.7rc1 r55917
  • pre-3.0.0alpha3 r55918 (the changes undid in r55928)
Comment by richlv [ 2015 Oct 04 ]

(1) looks like this broke compilation in trunk :

gcc -DHAVE_CONFIG_H -I. -I../../../include    -I../../../src/libs/zbxdbcache -g -O2  -I/usr/include/mysql -fmessage-length=0 \
-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DPIC -fPIC -fno-strict-aliasing -g -DNDEBUG \
  -I/usr/lib/perl5/5.16.2/x86_64-linux-thread-multi/CORE -I. -I/usr/include -I/usr/include     -MT libzbxserver_a-expression.o -MD -MP \
-MF .deps/libzbxserver_a-expression.Tpo -c -o libzbxserver_a-expression.o \
`test -f 'expression.c' || echo './'`expression.c
expression.c: In function 'substitute_simple_macros':
expression.c:2325:5: warning: passing argument 8 of 'substitute_simple_macros' from incompatible pointer type [enabled by default]
expression.c:2297:5: note: expected 'struct zbx_hashset_t *' but argument is of type 'char **'
expression.c:2325:5: warning: passing argument 9 of 'substitute_simple_macros' makes pointer from integer without a cast [enabled by default]
expression.c:2297:5: note: expected 'char **' but argument is of type 'int'
expression.c:2325:5: warning: passing argument 10 of 'substitute_simple_macros' makes integer from pointer without a cast [enabled by default]
expression.c:2297:5: note: expected 'int' but argument is of type 'void *'
expression.c:2325:5: error: too few arguments to function 'substitute_simple_macros'
expression.c:2297:5: note: declared here
make[3]: *** [libzbxserver_a-expression.o] Error 1

viktors.tjarve these changes in trunk have been reverted.

viktors.tjarve RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-9643 r56032

viktors.tjarve RESOLVED a minor issue in development branch svn://svn.zabbix.com/branches/dev/ZBX-9643 r56069

wiper CLOSED

Comment by Sandis Neilands (Inactive) [ 2015 Oct 08 ]

(2) Documentation should be updated.

What is the purpose of note in the documentation regarding positional macros in 'Configuring a trigger' page? My interpretation of 'constants in relatively simple, straightforward expressions' in context of the example given: expressions without macro expansions.

E.g. we should be more specific which expressions are NOT relatively simple and straightforward.

We should rework this confusing note.

https://www.zabbix.com/documentation/3.0/manual/config/triggers/trigger

Comment by Viktors Tjarve [ 2015 Oct 09 ]

(3) Similar issue at FRONTEND under Monitoring -> Dashboard where 'Last 20 issues' are displayed.

The issue name which is the trigger description is missing the constant if in trigger description $1 macro and in trigger expression user defined macro is used. Basically all three scenarios as described in description section above can be repeated here as well.

gunarspujats RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-9643-1

sasha The issue must be moved to the new ticket and fixed in pre-3.0.x only. I removed the dev branch.

MOVED to ZBX-10051

zalex_ua "Frontend" component removed too.

Comment by Andris Zeila [ 2015 Oct 13 ]

Server side successfully tested

Comment by Viktors Tjarve [ 2015 Nov 17 ]

Released in:

  • pre-2.2.11rc1 r56764
  • pre-2.4.7rc1 r56766
  • pre-3.0.0alpha5 r56777
Generated at Thu Apr 18 17:44:48 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.