[ZBX-6151] Cross-host reference in LLD trigger prototype ignored Created: 2013 Jan 18 Updated: 2017 May 30 Resolved: 2014 Mar 06 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | API (A), Frontend (F) |
Affects Version/s: | 2.0.4 |
Fix Version/s: | 2.0.12rc1, 2.2.3rc1, 2.3.0 |
Type: | Incident report | Priority: | Critical |
Reporter: | Roman Chapurny | Assignee: | Ivo Kurzemnieks |
Resolution: | Fixed | Votes: | 0 |
Labels: | lld, triggers | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Description |
I have 2 hosts (A and B) configured with LLD rule for discovery of some object collection, for example host file systems. I need to compare some attributes of corresponding objects, for example free disk space, and trigger an event if there's a mismatch or if difference is out of range. When an LLD trigger prototype created under host A that references LLD item prototype of host B is instantiated, reference to host B is substituted with a reference to host A. Consequently trigger expression that was meant to compare values of LLD discovered item on host A and host B compares value of this item on host A to itself. Instantiated triggers only get listed under host A in the GUI in this case. If LLD is not involved, this kind of trigger works as expected, hosts A and B are correctly referenced and values of respective items are compared. In addition, trigger that references both hosts gets listed under each host in the GUI. I'd expect LLD trigger functionality to be the same in this respect as a regular trigger, so I'm filing this as a bug. While this kind of cross-host references could be prone to mismatches (e.g. if a certain LLD item is discovered only on host A, but not on host B), these mismatches shouldn't be harmful, a trigger referencing non-existent item will not initialize until each referenced item is available/discovered under each host involved. Steps to reproduce: 2. Add 2 hosts (hostA and hostB), associate with this template 3. Go into LLD rule on host A, add trigger prototype with the following expression: {hostA:vfs.fs.size[{#FSNAME} ,pfree].last(0)} # {hostB:vfs.fs.size[ {#FSNAME},pfree].last(0)} # {hostA:vfs.fs.size[/,pfree].last(0)}5. If hostA:vfs.fs.size[/,pfree].last(0) and hostB:vfs.fs.size[/,pfree].last(0) are different, trigger is not activated as hostB:vfs.fs.size[/,pfree].last(0) is never evaluated. |
Comments |
Comment by Alexander Vladishev [ 2014 Feb 12 ] |
Zabbix doesn't support cross-host item prototype references in the trigger prototypes and graph prototypes. Frontend (API) should prevent possibility of creation of such prototypes. It is reproducible in 2.0.11 and 2.2.2. |
Comment by Ivo Kurzemnieks [ 2014 Feb 20 ] |
RESOLVED for 2.0 in svn://svn.zabbix.com/branches/dev/ZBX-6151 |
Comment by Alexander Vladishev [ 2014 Feb 25 ] |
(1) [@2.0 & @2.2] redundant check for count of array elements
if ($triggerPrototypes && count($triggerPrototypes) > 1) {
}
elseif (!$triggerPrototypes) {
}
Will be better so:
if (!$triggerPrototypes) {
}
elseif (count($triggerPrototypes) > 1) {
}
same issue with graph prototypes iivs RESOLVED for 2.2 in r42998 and 2.0 in r42999 sasha CLOSED |
Comment by Alexander Vladishev [ 2014 Feb 25 ] |
(2) [@2.0 & @2.2] variables $triggerPrototypes an $graphPrototypes should be renamed. These arrays doesn't contain triggers- or graphs-prototypes. iivs RESOLVED for 2.2 in r42998 and 2.0 in r42999 sasha CLOSED |
Comment by Alexander Vladishev [ 2014 Feb 25 ] |
(3) [@2.2] unnecessary check for emptiness of an array if ($graph['gitems']) { ... } iivs RESOLVED for 2.2 in r42998 and 2.0 in r42999 sasha CLOSED |
Comment by Alexander Vladishev [ 2014 Feb 25 ] |
(4) Error messages should contain names of the elements. iivs In 2.0 graphprototype.update would require extra select name from DB and as we discussed for graph prototypes we'll change error messages only for 2.2, but for trigger prototpes I've correct the error messages in both dev branches. RESOLVED for 2.2 in r42998 and 2.0 in r42999 sasha REOPENED In 2.0 error messages for trigger prototypes are fixed only in one place. iivs RESOLVED for 2.0 in r43001 sasha CLOSED |
Comment by Alexander Vladishev [ 2014 Feb 25 ] |
(5) Trigger- and graph-prototypes can contain item prototypes from one discovery rule. iivs RESOLVED for 2.0 in r43015 and 2.2 in r43016 sasha REOPENED
[@2.0] Undefined index: itemDiscovery [api/classes/CGraphPrototype.php:903] array_flip(): Can only flip STRING and INTEGER values! [api/classes/CGraphPrototype.php:906] [@2.2] Undefined index: parent_itemid [graphs.php:222 → CAPIObject->update() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CGraphGeneral->update() → CGraphPrototype->validateUpdate() → CGraphPrototype->checkCrossRefferenceDiscovery() in /home/sasha/zabbix-svn/branches/dev/ZBX-6151-22/frontends/php/api/classes/CGraphPrototype.php:805] array_flip(): Can only flip STRING and INTEGER values! [graphs.php:222 → CAPIObject->update() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CGraphGeneral->update() → CGraphPrototype->validateUpdate() → CGraphPrototype->checkCrossRefferenceDiscovery() → array_flip() in /home/sasha/zabbix-svn/branches/dev/ZBX-6151-22/frontends/php/api/classes/CGraphPrototype.php:808]
$createdTriggers = $this->get(array( 'triggerids' => $triggerids, 'output' => array('description'), 'selectItems' => array('itemid', 'hostid', 'flags') )); $updatedTriggers = $this->get(array( 'triggerids' => $triggerids, 'output' => array('description'), 'selectItems' => array('itemid', 'hostid', 'flags') ));
iivs RESOLVED for 2.0 in r43094 and for 2.2 in r43095 sasha REOPENED
iivs sasha CLOSED |
Comment by Alexander Vladishev [ 2014 Mar 07 ] |
2.2 removed strings:
2.2 new strings:
|
Comment by Alexander Vladishev [ 2014 Mar 07 ] |
2.2 was successfully tested with small fix in r43289. Please review. iivs REVIEWED. Thanks! |
Comment by Alexander Vladishev [ 2014 Mar 07 ] |
2.0 removed strings:
2.0 new strings:
|
Comment by Alexander Vladishev [ 2014 Mar 07 ] |
2.0 was successfully tested with small fix in r43291. Please review. iivs REVIEWED. Thanks! |
Comment by Ivo Kurzemnieks [ 2014 Mar 07 ] |
Fixed trigger prototype and graph prototype validation so items are no longer allowed from multiple discovery rules. For 2.0 additionally fixed filter by flags not overriding in item.get method For 2.2 additionally fixed graph and graph prototype update validation allowing to pass only 'gitemid' parameter without 'itemid'. And added missing graph prototype is error message when validation non-numeric items. API Changes documented: Fixed in pre-2.0.12rc1 r43301, pre-2.2.3rc1 r43305 and pre-2.3.0 (trunk) r43306 |