[ZBXNEXT-1208] Conditions in calculated items Created: 2012 Apr 28  Updated: 2025 May 23

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: Server (S)
Affects Version/s: 2.0.0
Fix Version/s: None

Type: New Feature Request Priority: Major
Reporter: Attilla de Groot Assignee: Alexei Vladishev
Resolution: Unresolved Votes: 25
Labels: calculateditems, conditions
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Hi,

For any number of reasons you might want a value not to be taken into account in the calculation. This can be accomplished by updating the item using the API, but this can be not flexible enough in some situation, because wrong values might be used in the calculation before the formula is updated.

I would like to have condition possibility in a calculated item. This allows us to ignore values of a certain item when the value of another item has a certain value (eg: state == "maintenance" or value > 100000).



 Comments   
Comment by Leonardo Savoini [ 2018 Aug 01 ]

Maybe this can be very easy if they add a function into zabbix -> if(condition, true, false)
Just like in a spreedsheet.
That will solve an issue when I need absolute values. ex: if(number < 0, number * -1, number)

Comment by user185953 [ 2025 Apr 02 ]

I also hope for way to ignore values based on another item.
For example it would be useful if I can ignore values around restarts, so ignore values if uptime item is nodata() or below 5 minutes.

Comment by user185953 [ 2025 May 23 ]

Wait a minute... by https://www.zabbix.com/documentation/current/en/manual/config/triggers/expression#operators zabbix True calculates as "1" and False calculated as "0"!

 

This allows ignoring bad values like this:

last(//value.raw)
/
(
(test condition 1) and
(test condition 2) and
(test condition 3)
)

Preprocessing:

Name Parameters  
Check for not supported value error matches division by zero

 

How this works:

  • True condition divides by 1 (True) so preserves original value
  • False condition divides by 0 (False) so gives division by zero catched by preprocessing
Generated at Sun Jul 06 01:15:18 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.