[ZBX-19871] Trigger use old data from dependent item Created: 2021 Aug 27 Updated: 2021 Sep 30 Resolved: 2021 Sep 30 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Server (S) |
Affects Version/s: | 5.4.3 |
Fix Version/s: | None |
Type: | Problem report | Priority: | Trivial |
Reporter: | Yurii Polenok | Assignee: | Unassigned |
Resolution: | Duplicate | Votes: | 0 |
Labels: | dependentitems, expressions, history, problem, trigger | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: |
![]() ![]() ![]() ![]() |
||||||||
Issue Links: |
|
Description |
Comments |
Comment by Yurii Polenok [ 2021 Sep 22 ] |
Hi |
Comment by Oleksii Zagorskyi [ 2021 Sep 22 ] |
I could not reproduce it on a more simple scenario, where key point is ti use dependent item in trigger and {ITEM.LASTVALUE} macro in trigger name. It's strange that for 2nd item in expression you do a comparison (>0) which should work for numeric items, while on history we see that the item collected Str/Text values. Please try to reproduce the issue with more simple setup, with simple dependent item, without any preprocessing steps etc. Then step by step change it to be similar like in production to find out what exactly fails. I suppose this way you will find a misconfiguration on your side. |
Comment by Yurii Polenok [ 2021 Sep 22 ] |
I need to use in the trigger the information from the second item, for this I added it to the expression. Since this is a text item, I use length(*last(/Template/item))> 0*. First item: json = JSON.parse(value); if (json.length === 0) { return value; } else { res = ""; json.forEach(function (o) { res += JSON.stringify(o.BLOCKER)+":"+ JSON.stringify(o.BLOCKED_OBJ)+":"+ JSON.stringify(o.LOCK_TYPE)+"\n"; }); return res; } Second item: json = JSON.parse(value); function getValue(data) { res = ""; data.forEach(function (o) { res += JSON.stringify(o.BLOCKER)+":"+ JSON.stringify(o.BLOCKED_OBJ)+":"+ JSON.stringify(o.LOCK_TYPE)+", "; }); return res.slice(0, -2); } if (json.length > 3) { res = getValue(json.slice(0, 3)); res += " + "+(json.length-3)+" more blockers"; } else { res = getValue(json); } return res; |
Comment by Oleksii Zagorskyi [ 2021 Sep 22 ] |
Ok, I did not spot length() function, that's ok for 2nd part of expression. Well, it's about trigger processing refactoring, which is not a bug. If you have logical dependencies of two items (disregarding that they are dependent on the same master) used in single expression, you should not use so sensitive function like last(). |
Comment by Oleksii Zagorskyi [ 2021 Sep 22 ] |
I do not have other suggestions than close it as Won't fix. |
Comment by Oleksii Zagorskyi [ 2021 Sep 30 ] |
I feel like it's duplicate of ZBXNEXT-6284. |