[ZBXNEXT-1420] Provide ability to create calculated item based on several discovered ones Created: 2012 Sep 10  Updated: 2022 Apr 22  Resolved: 2021 Oct 28

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Server (S)
Affects Version/s: 2.0.2
Fix Version/s: 5.4.7

Type: New Feature Request Priority: Minor
Reporter: Dominik Borkowski Assignee: Unassigned
Resolution: Fixed Votes: 140
Labels: aggregate, calculateditems, items, lld
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates ZBX-14603 Why can not aggregate all item protot... Closed

 Description   

Right now there seems to be no mechanism that could be used to perform a calculation on an unspecified number of items, which were created by discovery. Consider the following scenario:

  • discovery rule is used with snmpwalk to iterate a number of switch interfaces, PDU legs, or filesystems
  • to keep track of total switch traffic, current flowing through all legs on PDU, or total amount of stored data, a function similar to this would be great:

sum(last("ItemName[*]"))

This would allow to create more generic and flexible templates, and take better advantage of the wonderful framework of discovery.

Another option would be to have aggregate function that could be used within the template to be specific to said host.

keywords : lld



 Comments   
Comment by Alexei Vladishev [ 2012 Oct 09 ]

I like it, should be implemented at some point.

Comment by Raymond Kuiper [ 2012 Oct 15 ]

+1

Comment by Samgarr [ 2012 Nov 19 ]

+1!

Comment by richlv [ 2012 Nov 19 ]

ZBXNEXT-1521 asks for this in aggregate items

Comment by Mateusz Kwiatkowski [ 2012 Dec 20 ]

+1

Comment by richlv [ 2012 Dec 20 ]

please do not clutter issues with such comments - see https://zabbix.org/wiki/Docs/bug_reporting_guidelines#Reporting_an_issue

Comment by Lars Arnth Jessen [ 2013 Dec 06 ]

+1

Comment by Simon Wetzstein [ 2014 May 05 ]

+1

Comment by Oleksii Zagorskyi [ 2014 Jun 05 ]

ZBXNEXT-1521 could help to achieve some mentioned task.

Comment by Oleksii Zagorskyi [ 2016 Feb 29 ]

ZBXNEXT-2707 asks for aggregate item based on lld.

Comment by Sébastien Maccagnoni [ 2016 May 30 ]

+1

Comment by Shane Davidson [ 2016 Aug 16 ]

+1

Comment by richlv [ 2016 Aug 16 ]

please do not clutter issues with such comments - see https://zabbix.org/wiki/Docs/bug_reporting_guidelines#Reporting_an_issue

If you want to show that you also suffer from a particular problem and would like to see it fixed, vote on it.

see the vote feature in the upper right corner of this page.

Comment by Jacek [ 2017 Mar 21 ]

Hey,
guys, is there a chance that this is going to be impelemented? Or maybe some kind of variation on aggregate check that would calculate items on one host (instead of group of hosts) by their, for example, application? Having access to this functionality natively would be awesome and for sure it would be 'clean and non-hackish'

I'd upgraded server to version 3.2.4 and all lld calculated items, which where summing dynamic number of other lld items within one host just died (case similar to ZBX-11700 or ZBX-11411), due to newly implemented limitations

Comment by richlv [ 2017 Mar 21 ]

if lack of a specific feature is important to you, please consider financed development.

until this feature appears, this example script to create graphs could be easily adapted to create calculated items
http://www.zabbixbook.com/2017/02/07/zabbix-api-example-creating-a-graph-with-lld-generated-items/

Comment by Jacek [ 2017 Mar 21 ]

Thanks for a quick response!
I'm afraid that amount of funds needed to develop one feature is just out of my range .
Until I figure this example script out, I guess downgrading server would be the fastest solution for me.

Comment by cgaspar [ 2017 Oct 27 ]

had similar issue, to workaround the issue, I create a script which take a regex and create a calculated item or graph based on found item.
Check out https://github.com/cgasp/zabbix-aggregate-items

Comment by Ronald Rood [ 2018 Feb 08 ]

would it make sense to implement this as - for example -
sum(last("vfs.fs.size[*,total]"))
where in this case the discovered filesystem is a wildcard, or maybe even a regexp to make it even more versatile ....
?

Comment by Jun Liu [ 2018 May 04 ]

Strongly +1

before this implemented, I have to update the workaround  "last(item[0]) + last(item[1]) + last(item[2])...“ frequently, because the item[x] will change frequently.

Comment by Josef Hopfgartner [ 2018 Jul 24 ]

The following SQL-query shows a result for discovered items created by prototypes from this project:

https://github.com/Scatty81/zabbix-windows.git

It queries all Hosts, where Java Runtime

Name.{26A24AE4%

has multiple installations - which often leads to problems.

select ap.name
, ho.name
, substring(it.name, 1, 29)
, string_agg(distinct hi.value::text, ' ')
from hosts ho
join items it on it.hostid = ho.hostid
join items_applications ia on ia.itemid = it.itemid
join applications ap on ia.applicationid = ap.applicationid
join history_text hi on hi.itemid = it.itemid
where ap.name like 'Software'
and it.name like 'Name.{26A24AE4%'
group by ho.name, ap.name, substring(it.name, 1, 29)
having count(*) > 1
order by 1, 2, 3

This would of course be better achieved with this Issue.

Comment by Vadims Kurmis [ 2019 Apr 07 ]

Why this still not implemented?

This is obvious that it is a needed and a must be feature.

 

Comment by Waldemar Faist [ 2019 Apr 10 ]

We have the same problem here: We use a discovery to discover network interfaces and create items for in/out traffic per interface. A very common demand is to sum the in/out traffic of every bonded interface to get the actual traffic.

Are there any workarounds since this issue is open for 7 years?

Comment by Alex Rydzewski [ 2019 Jun 05 ]

Hi sirs!

I do think about what if merge this issue with ZBXNEXT-1521 and ZBXNEXT-2707 by add to calculated items ability use functions from aggregated items and regexs or wildcards. As results can be key with custom name type of calculated items, for example:

grpsum["host group","host","item key or standard function eg last()"]

This may be like:

grpsum[,the.host.dom","my_discovery_item_key[eth$\{MACROS}.last()"]

${MACROS}=regex([0-9])

Comment by webbix [ 2019 Jul 19 ]

+1

Comment by paul martinez [ 2019 Dec 23 ]

+1

Comment by Nikita [ 2020 Feb 07 ]

+1

Comment by Matej Kotras [ 2020 Jun 23 ]

+1

this is especially useful, for monitoring discovered parallel jobs, where number of jobs on hosts can differ, but if they fail, one trigger over all of them would be sufficient

or one action over multiple triggers, that when i have 20 parallel jobs, I don't need to receive 20 emails, just one would be enough even if multiple jobs fail.

 

Comment by Alexandru Tica [ 2020 Oct 09 ]

+1

I can't believe this is not part of Zabbix already!

Comment by Patrese Pinheiro [ 2020 Oct 09 ]

+1

I can't believe this is not part of Zabbix already! (me too!)

Comment by Juliano Barbosa [ 2020 Oct 10 ]

+1

Comment by Attila Varga [ 2020 Nov 27 ]

+1

Comment by dimir [ 2020 Nov 27 ]

We'll try to have it in 5.4 but we need a nice and clean implementation design for this one.

Comment by Attila Varga [ 2020 Nov 27 ]

Thank you.

Comment by balaji sivamani [ 2020 Dec 10 ]

is the much needed ,please help to develop this

Comment by LivreAcesso.Pro [ 2021 Mar 25 ]

+1

 

Comment by Enrique JEANNE [ 2021 May 07 ]

+1, need this too

Comment by Alex Kalimulin [ 2021 Jun 14 ]

It's now possible in Zabbix 5.4.

Suppose you have a discovery rule that returns LLD macro {#INDEX} and creates items like discovered_key[{#INDEX}]. Then you can define a calculated item with the formula sum(last_foreach(//discovered_key[*])) which will calculate the sum of last values for all discovered items.

Are there any use cases that are not covered by this approach?

Comment by Sam Potekhin [ 2021 Jul 26 ]

Hello, I tested this new feature. I'm trying to add following item:

sum(last_foreach(/*/net.if.in.discards[ifInDiscards.*]?[group="DC/Switches"]))

Returns error "Cannot evaluate function: no items matching query at ...". Host group specified correctly. Item name copied from original template (Interfaces SNMP). I not yet understand what I've done wrong.

Comment by Tomasz Fidecki [ 2021 Jul 26 ]

The following one worked for me:

sum(last_foreach(/*/titanDiameterNgPeerServerResultCount[*,*,*],5m))
Comment by Ivo Palli [ 2021 Oct 28 ]

I have a problem. I'm doing an LLD via the ssh.run method. Meaning my item keys end up like:

  • ssh.run[myvalue_item1]
  • ssh.run[myvalue_item2]
  • ssh.run[myvalue_item3]

I would like to do

sum(last_foreach(//ssh.run[myvalue_*]))

but end up with the error

Cannot evaluate function: item "/test_host/ssh.run[myvalue_*]" does not exist at "last_foreach(//ssh.run[myvalue_*]))

I can do ssh.run[*] but that would include everything I do via SSH on that host which is not what I want.

So how (if possible) do I fix this?

Comment by Alex Kalimulin [ 2021 Oct 28 ]

RenHoek, asterisks '*' in the item filters work like placeholders for hosts, keys or argument positions. Thus these are not capable of partial argument matching.

Comment by Ivo Palli [ 2021 Oct 28 ]

Alex Kalimulin : So how do I do it then? Is there some sort of regex function I can use? Should I put in a feature request?

Comment by Alex Kalimulin [ 2021 Oct 28 ]

RenHoek, there is no regex processing for this use case. Please feel free to add a new feature request.

Comment by Alex Kalimulin [ 2021 Oct 28 ]

This is resolved since 5.4, closing.

Generated at Sat Apr 27 08:24:02 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.