[ZBXNEXT-7927] count_foreach function needs operators like "greater than" Created: 2022 Aug 18  Updated: 2024 Mar 08  Resolved: 2023 May 15

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

Type: New Feature Request Priority: Trivial
Reporter: Mehmet Ali Buyukkarakas Assignee: Unassigned
Resolution: Duplicate Votes: 4
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Sub-task
part of ZBXNEXT-8355 Aggregation calculation improvements Closed
Epic Link: Zabbix 7.0

 Description   

I need to create a calculated item, which will calculate the NUMBER of interfaces with status DOWN.

Basically I need a foreach function with operators, to filter some values matching a condition like "greater" or "less than"

I made some researches. There is a trigger function count which gives us the chance of using operators like "less than", "greater than". https://www.zabbix.com/documentation...ctions/history

But the problem is, there is no way to calculate "number of up interfaces" in a trigger and create the alert.
We need something in item functions. But the related item functions dont provides operators. https://www.zabbix.com/documentation...ated/aggregate

According the documentation, it is not possible to write something like this ;

count(last_foreach(//net.if.status,1h,"lt",2))
or
count(count_foreach(/*/net.if.status,1h,"lt",2))



 Comments   
Comment by Alex Kalimulin [ 2023 Feb 22 ]

last_foreach() should return last, retaining the same behavior as for historic last() (so last_foreach(//net.if.status,1h,"lt",2) would be kind of confusing).

But something like count(last_foreach(/*/net.if.status?[group="Linux servers"]),"eq",2) would be helpful (e.g. count number of interfaces with last down status).

Also, count(count_foreach(/*/net.if.status?[group="Linux servers"],1h,"eq",2),"gt",0) could be used to count interfaces that were down within the last hour.

Comment by Dmitrijs Goloscapovs [ 2023 May 15 ]

This functionality was implemented in context of ZBXNEXT-8355 and is going to be available since 7.0.0alpha1.

Generated at Sun Mar 30 15:18:56 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.