[ZBXNEXT-4005] Inroduce trigger expression CLAUSE 'IN'. Compare received value to an array of values. Created: 2017 Jul 28  Updated: 2021 May 21  Resolved: 2021 May 21

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Change Request Priority: Trivial
Reporter: Vitaly Zhuravlev Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: expressions, functions, trigger
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

It would really good to have shortcut clause 'IN' similar to SQL.
To compare single value to array of values in a single expression.

so expression like this:

{HOST:METRIC.last()}=0 or
{HOST:METRIC.last()}=2 or
{HOST:METRIC.last()}=111 or
{HOST:METRIC.last()}=4 or
{HOST:METRIC.last()}=7 or
{HOST:METRIC.last()}=5 or
{HOST:METRIC.last()}=111

could become:

{HOST:METRIC.last()} IN (0,2,111,4,7,5,111)

or like this:

{Template SNMP Interfaces SNMPv2:net.if.speed[ifHighSpeed.{#SNMPINDEX}].change()}<0 and (
{Template SNMP Interfaces SNMPv2:net.if.type[ifType.{#SNMPINDEX}].last()}=6 or
{Template SNMP Interfaces SNMPv2:net.if.type[ifType.{#SNMPINDEX}].last()}=7 or
{Template SNMP Interfaces SNMPv2:net.if.type[ifType.{#SNMPINDEX}].last()}=11 or
{Template SNMP Interfaces SNMPv2:net.if.type[ifType.{#SNMPINDEX}].last()}=62 or
{Template SNMP Interfaces SNMPv2:net.if.type[ifType.{#SNMPINDEX}].last()}=69 or
{Template SNMP Interfaces SNMPv2:net.if.type[ifType.{#SNMPINDEX}].last()}=117
)

to this:

{Template SNMP Interfaces SNMPv2:net.if.speed[ifHighSpeed.{#SNMPINDEX}].change()}<0 and (
{Template SNMP Interfaces SNMPv2:net.if.type[ifType.{#SNMPINDEX}].last()} IN (6,7,11,62,69,117) 
)


 Comments   
Comment by Alexei Vladishev [ 2021 May 21 ]

Support of new functions in() and between() was implemented in Zabbix 5.4, enjoy!

Generated at Fri Apr 26 14:16:38 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.