[ZBX-1027] {TRIGGER.VALUE} cannot be used in trigger expression Created: 2009 Sep 04  Updated: 2017 May 30  Resolved: 2009 Sep 23

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 1.6.6
Fix Version/s: None

Type: Incident report Priority: Major
Reporter: Aron Ujvari Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Zabbix 1.6.6



 Description   

When I try to create a hysteresis trigger I get the following error message: "An item key must be used in trigger expression"

I have traced down the problem and I found that in version 1.6.6 there is a new piece of code in include/triggers.inc.php starting from line 716:

if($arr[ZBX_EXPRESSION_MACRO_ID] && !isset($ZBX_TR_EXPR_ALLOWED_MACROS[$arr[ZBX_EXPRESSION_MACRO_ID]]) )

{ error('Unknown macro ['.$arr[ZBX_EXPRESSION_MACRO_ID].']'); return false; }

else if( !$arr[ZBX_EXPRESSION_MACRO_ID] )

{ ... }

// line 716:
else

{ error('An item key must be used in trigger expression'); return false; }

Since the first two "if" expression does not allow the usage of

{TRIGGER.VALUE}

macro it goes always to this "else" branch, that gives an error.

I think the first "if" expression should be splitted into two to like this to allow valid macros to be used and only deny the not allowed macros:

if($arr[ZBX_EXPRESSION_MACRO_ID]) {
if (!isset($ZBX_TR_EXPR_ALLOWED_MACROS[$arr[ZBX_EXPRESSION_MACRO_ID]]) )

{ error('Unknown macro ['.$arr[ZBX_EXPRESSION_MACRO_ID].']'); return false; }

}
else if( !$arr[ZBX_EXPRESSION_MACRO_ID] ) {
:



 Comments   
Comment by richlv [ 2009 Sep 17 ]

possibly side-effect of fixing ZBX-964

Comment by Alexey Fukalov [ 2009 Sep 21 ]

fixed in rev: 7931 | 1.6 branch

Comment by richlv [ 2009 Sep 22 ]

confirming the fix in rev 7932

Generated at Fri Apr 19 21:35:41 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.