[ZBXNEXT-1911] Allow Text datatype Calculated items Created: 2013 Sep 16 Updated: 2024 Apr 10 Resolved: 2022 Jan 28 |
|
Status: | Closed |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Frontend (F), Server (S) |
Affects Version/s: | None |
Fix Version/s: | 6.0.0beta3, 6.0 (plan) |
Type: | New Feature Request | Priority: | Trivial |
Reporter: | Maxim Krušina | Assignee: | Dmitrijs Goloscapovs |
Resolution: | Fixed | Votes: | 26 |
Labels: | aggregate, calculateditems | ||
Σ Remaining Estimate: | Not Specified | Remaining Estimate: | Not Specified |
Σ Time Spent: | Not Specified | Time Spent: | Not Specified |
Σ Original Estimate: | Not Specified | Original Estimate: | Not Specified |
Issue Links: |
|
||||||||||||
Sub-Tasks: |
|
||||||||||||
Team: | Team A | ||||||||||||
Sprint: | Sprint 83 (Dec 2021), Sprint 84 (Jan 2022) | ||||||||||||
Story Points: | 1 |
Description |
I've got lot of textual string, ie, when monitoring LAMP server, I have versions of PHP, Apache, MySQL... every version in separate Item. Apache version: XXX This would be really usefull when displaying lot of info in Screens - now I have to add separate cell for every single item. |
Comments |
Comment by Constantin Oshmyan [ 2015 Oct 15 ] | ||||||||||||||||||||||||||||||
I have a very similar problem.
The problem is that each line contains info from the several items:
So, it is necessary to concatenate the values of the listed items as well as some additional text constants (strings "Device: ", ", OS: ", "sp", dot between the Major- and Minor-versions, etc.). Item types are mostly text ("Character"), but some of them could be numeric (for example, Major & Minor as well as Build Number are "Numeric unsigned"). It is possible to insert into a Screen the separate value only (for example, the resource "Plain Text", then – specific Item). However, with such approach the resulting Screen will be cumbersome and hard for perception: there will be 9 lines instead of 2 (additionally containing needless Item names). It is possible to use some external script that will collect information from devices, perform it into needed format and then send into Zabbix using zabbix_sender. However, it seems stupid to write (and then maintain) an additional scripts for SNMP-polling when Zabbix-server has it own embedded SNMP-poller. It could be great to concatenate several values into the single value using the Calculated Items mechanism; however, at the moment Calculated Items supports only Numerc types, operations and functions As a solution, I'd like to have a Calculated Items that could have a string type ("Character" or "Text") and allow string operations (at list – concatenation, then could be substring, etc.) on any operand (numeric operands should be converted onto strings). | ||||||||||||||||||||||||||||||
Comment by Pavel Volkovitskiy [ 2017 Nov 06 ] | ||||||||||||||||||||||||||||||
Another use case would be to receive the previous item value in alert emails ie, I was going to add last("key", #2) as calculated item, but unfortunately, a referenced item has "Character" type | ||||||||||||||||||||||||||||||
Comment by Glebs Ivanovskis (Inactive) [ 2017 Nov 06 ] | ||||||||||||||||||||||||||||||
For notification messages you can use something like {{HOST.HOST1}:{ITEM.KEY1}.last(#2)} | ||||||||||||||||||||||||||||||
Comment by Pavel Volkovitskiy [ 2017 Nov 06 ] | ||||||||||||||||||||||||||||||
Sure, but then I'll have to add a special action for it | ||||||||||||||||||||||||||||||
Comment by Glebs Ivanovskis (Inactive) [ 2017 Nov 06 ] | ||||||||||||||||||||||||||||||
You would still need it with calculated item, no? I don't fully understand what you are trying to achieve... | ||||||||||||||||||||||||||||||
Comment by Pavel Volkovitskiy [ 2017 Nov 11 ] | ||||||||||||||||||||||||||||||
With calculated item, I'll be able to use "standard" action similar to 1. {ITEM.NAME1}: {ITEM.VALUE1} 2. {ITEM.NAME2}: {ITEM.VALUE2} 3. {ITEM.NAME3}: {ITEM.VALUE3} that's not big deal, but sometimes can be useful and it's not obvious why calculated items can't be Character or Text if some functions (like last()) support them | ||||||||||||||||||||||||||||||
Comment by Glebs Ivanovskis (Inactive) [ 2017 Nov 12 ] | ||||||||||||||||||||||||||||||
It took some time, but I think I've got it now. So you basically need a calculated item with last(#2) aka prev() because even if you would use prev() in trigger expression {ITEM.VALUE} would resolve to last(). Actually, you may be interested in | ||||||||||||||||||||||||||||||
Comment by Constantin Oshmyan [ 2021 Aug 06 ] | ||||||||||||||||||||||||||||||
Another use-case for this feature request. There is task: to have a text item that contains the top-5 list of processes that are loading CPU at the moment on the Windows host. We can use a PowerShell script for this task; but it's a bad solution: PowerShell is a "hard" enough – it takes a lot of time and CPU during start, and it influences itself onto the result. msedge,648 powershell,84 svchost,33 The only problem is that the resulting digits could be more than 100% on multi-core CPU systems. So, ideally, we would like to have all these numbers being divided by a number of cores (eight cores in this example): msedge,81 powershell,10.5 svchost,4.125 The number of CPU cores could be obtained using a system.cpu.num metric. However, it's impossible to access the values of another items in a preprocessing stage. This task could be solved using a calculated item and some script in its preprocessing; but calculated items still do not support any operations with non-numeric operands (multiline text value in this example). | ||||||||||||||||||||||||||||||
Comment by Alexei Vladishev [ 2021 Dec 21 ] | ||||||||||||||||||||||||||||||
This functionality is coming in 6.2, the work is already in progress. It is also possible (no guarantees!) that we manage to include it into 6.0. | ||||||||||||||||||||||||||||||
Comment by Dmitrijs Goloscapovs [ 2022 Jan 19 ] | ||||||||||||||||||||||||||||||
Available in versions:
Documentation updated: | ||||||||||||||||||||||||||||||
Comment by Alexei Vladishev [ 2022 Jan 20 ] | ||||||||||||||||||||||||||||||
Great news, it is coming in Zabbix 6.0 LTS! | ||||||||||||||||||||||||||||||
Comment by Mickael Martin (Cyres) [ 2022 Jan 20 ] | ||||||||||||||||||||||||||||||
Yeah ! Thank you very much ! | ||||||||||||||||||||||||||||||
Comment by Constantin Oshmyan [ 2022 Jan 28 ] | ||||||||||||||||||||||||||||||
Hi! Very good news, thanks!
It seems that both links are not very accurate: the first one refers to the current version (5.4) instead of 6.0; the second one refers to the Prometheus metrics processing. An additional question: will it be possible to use a string functions for the items with Numeric types?
If not, maybe – it's reasonable to have a some simple additional function like "string()" for transforming of any Numeric value onto the string? | ||||||||||||||||||||||||||||||
Comment by Alexander Vladishev [ 2022 Jan 31 ] | ||||||||||||||||||||||||||||||
Thanks for your feedback! Both links has been fixed. All string functions can be used for all data types without any transformations. | ||||||||||||||||||||||||||||||
Comment by Constantin Oshmyan [ 2022 Jan 31 ] | ||||||||||||||||||||||||||||||
sasha, great, thanks! |