[ZBX-13424] Pre-processing doesn't work in calculated item Created: 2018 Feb 01 Updated: 2024 Apr 10 Resolved: 2018 Mar 17 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | API (A), Templates (T) |
Affects Version/s: | 3.4.6 |
Fix Version/s: | 3.4.8rc1, 4.0.0alpha5, 4.0 (plan) |
Type: | Problem report | Priority: | Minor |
Reporter: | Vadims Kurmis | Assignee: | Ivo Kurzemnieks |
Resolution: | Fixed | Votes: | 0 |
Labels: | items, templates, webmonitoring | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Team: | Team B |
Team: | Team B |
Sprint: | Sprint 27, Sprint 28, Sprint 29 |
Story Points: | 1 |
Description |
Steps to reproduce: Have Web Scenario, which generates several items. Those cannot be edited directly, but can be referenced in Triggers and newly created items - just fine. One of them is: web.test.error[Get-Status], which contains text string of last error. Then I create item: Formula:
last("web.test.error[Get-Status]")
and even this:
last(\"web.test.error[Get-Status]\")
Pre-Processing: I have tried both: Reg-exp: ^.+([0-9]+$ Value: \1 OR Trim Left: 69 Trim Right: 2 Result: Item not supported. Expected: Expected that this calculated item would strip-out numeric value from another item, a have it stored as numeric item. Could anyone explain me, WHY there are pre-processing options like "regexp" and "trim" in "calculated item" type, if those simply do not work? |
Comments |
Comment by Glebs Ivanovskis (Inactive) [ 2018 Feb 01 ] |
Instead of calculated item try dependent item. I think it should work. |
Comment by Vadims Kurmis [ 2018 Feb 01 ] |
No, unfortunately Dependent Item - Doesn't see "webscenario items" |
Comment by richlv [ 2018 Feb 02 ] |
is your regexp missing closing parenthesis, and incorrectly anchoring to the end of the string ? |
Comment by Vadims Kurmis [ 2018 Feb 02 ] |
No, it was a typo. Regex: ^.([0-9])+$ |
Comment by Vadims Kurmis [ 2018 Feb 02 ] |
To me, the logic in this case looks the following: 1) 2) 3) 4) Evaluation against Numeric or Float data type should be initiated only when required. It it required: |
Comment by Vadims Kurmis [ 2018 Feb 02 ] |
Here, I found a comment that confirms my thoughts: In Ticket: |
Comment by Vadims Kurmis [ 2018 Feb 02 ] |
From documentation: https://www.zabbix.com/documentation/3.4/manual/config/items/itemtypes/calculated The correct syntax of a simple formula is: now if we check functions link: we find this definition: and at the bottom of page we see: This is confusing. |
Comment by Glebs Ivanovskis (Inactive) [ 2018 Feb 02 ] |
Let me do some explanation... First of all, I strongly recommend you read a beautiful piece of documentation describing operation of item preprocessing. 1) I agree, applying regexps and trimming numbers does not make much sense. Usually. But since Zabbix really lacks mathematical operations, regexp can save you someday. You completely miss the fact that there could be many items in calculated item formula and it would be strange to apply same preprocessing to all of them. As I said, for your use case you should create a Dependent item. I know it is not possible at the moment, but maybe it's a bug. I'll try to figure out why such decision was made and will get back to you later. Stay tuned. |
Comment by Glebs Ivanovskis (Inactive) [ 2018 Feb 02 ] |
They only work if your Character, Text or Log item for some reasons stores numbers, see ZBX-10449. |
Comment by Vadims Kurmis [ 2018 Feb 02 ] |
"But from another perspective it's postprocessing" That's it. Pre - processing - is logically - apply some specific action, that happens over data - Before actual data processing. But this really is - Post-processing. - means - apply some specific action - AFTER we have acquired and made manipulations on data. "You completely miss the fact that there could be many items in calculated item formula and it would be strange to apply same preprocessing to all of them." I agree, this makes sense. But this name "pre-processing" - is incorrect then. |
Comment by Vadims Kurmis [ 2018 Feb 02 ] |
what about last() function which in documentation said: supports - num, float, str, text types |
Comment by Glebs Ivanovskis (Inactive) [ 2018 Feb 02 ] |
"Processing" is triggers, for all item types. Formula is a kind of "data gathering" for calculated items. "Preprocessing" means "before processing triggers". I hope this starts to make sense if you think of it this way. |
Comment by Vadims Kurmis [ 2018 Feb 02 ] |
this ZBX-10449 doesn't throw a light on this behavior. as documentation says: Supported value types: float, int, str, text, log why it then evaluates on numeric and fails? |
Comment by Vadims Kurmis [ 2018 Feb 02 ] |
"I hope this starts to make sense if you think of it this way." Because pre-processing of data - literally means - apply some changes - before actual data manipulation. I have worked in DSP (Digital Signal Processing) laboratory so I exactly understand the term of "processing" |
Comment by Vadims Kurmis [ 2018 Feb 02 ] |
and that " a beautiful piece of documentation " |
Comment by Vadims Kurmis [ 2018 Feb 05 ] |
Hello, any updates on why "web monitoring" items are not available for "dependent items" ? |
Comment by Vadims Kurmis [ 2018 Feb 05 ] |
I've noticed this thing is controlled by an URL, which is popped when I press "select" dependent item. http:/zabbix.server/popup.php?srctbl=items&srcfld1=itemid&dstfld1=master_itemid&dstfrm=itemForm&srcfld2=master_itemname&dstfld2=master_itemname&only_hostid=32&with_webitems=0&excludeids[]= as you can see, the argument value "with_webitems=0" possibly is the key to how web items were hidden. |
Comment by Vadims Kurmis [ 2018 Feb 05 ] |
Yes, I confirm, that opening this url with with_webitems=1 - does Unhide web items. |
Comment by Glebs Ivanovskis (Inactive) [ 2018 Feb 06 ] |
Discussed and the conclusion is that Web scenario items should be available for selection as master item. |
Comment by Vadims Kurmis [ 2018 Feb 06 ] |
I tried to trick the system, changed hardcoded setting with_webitems to "1", then changed passed HTTP headers, but Zabbix system designed smarter. Thanks, that may help some day to those who want to reflect web scenario failures or web page load speed on a graph, for example, or those who want to get and process error of web scenarios. I just wanted to read Ink levels on a web page from HTTP enabled printer, which does not have SNMP. And create numeric items from obtained ink levels on a printer web page. |
Comment by Ivo Kurzemnieks [ 2018 Feb 23 ] |
(1) translation string changes Strings added:
Strings deleted:
sasha RESOLVED iivs Thanks! CLOSED |
Comment by Ivo Kurzemnieks [ 2018 Feb 23 ] |
RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-13424 |
Comment by Vadims Kurmis [ 2018 Feb 27 ] |
Hi, Do you add these web items to be visible in "Calculated items" as well? |
Comment by Ivo Kurzemnieks [ 2018 Mar 15 ] |
Fixed in:
|
Comment by Ivo Kurzemnieks [ 2018 Mar 15 ] |
(5) [D] API documentation updated. sasha CLOSED |