[ZBX-8428] slow API Items->get() with output extended Created: 2014 Jul 02  Updated: 2017 May 30  Resolved: 2014 Oct 27

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 2.2.4
Fix Version/s: 2.2.6rc1, 2.3.3

Type: Incident report Priority: Trivial
Reporter: dakol Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: api, latestdata, performance
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

according to ZBX-7373, getting latest values is faster.

But via API, it is still slow.

It seems, the CItem class do not passe the "period", to HistoryManager->getLast()
public function getLast(array $items, $limit = 1, $period = null)

{ Quick & dirty patch: diff -ru zabbix-2.2.4/api/classes/CItem.php zabbix-dev-2.2.4/api/classes /CItem.php --- zabbix-2.2.4/api/classes/CItem.php 2014-07-02 12:41:20.901291000 +0200 +++ zabbix-dev-2.2.4/api/classes/CItem.php 2014-07-02 13:59:42.104836000 +0200 @@ -1202,7 +1202,7 @@ $requestedOutput['prevvalue'] = true; }


if ($requestedOutput) {

  • $history = Manager::History()->getLast($result, 2);
    + $history = Manager::History()->getLast($result, 2, 3600);
    foreach ($result as &$item) {
    $lastHistory = isset($history[$item['itemid']][0]) ? $history[$item['itemid']][0] : null;
    $prevHistory = isset($history[$item['itemid']][1]) ? $history[$item['itemid']][1] : null;


 Comments   
Comment by Krists Krigers (Inactive) [ 2014 Jul 15 ]

Added period and made adjustments where necessary to preserve functionality elsewhere.
Fix for 2.2 committed in r47328, branch svn://svn.zabbix.com/branches/dev/ZBX-8428.
Fix for 2.3.3 (trunk) committed in r47341, branch svn://svn.zabbix.com/branches/dev/ZBX-8428-trunk.

Comment by Oleg Egorov (Inactive) [ 2014 Jul 16 ]

(1) String changes?

kristsk No string changes. RESOLVED.

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Jul 16 ]

(2) maps.inc.php:475

$lastValue = Manager::History()->getLast(array($item), 1);

getLast

public function getLast(array $items, $limit = 1, $period = null) {

1 is extra attribute

Same issue in CScreenClock.php:44

kristsk RESOLVED in r47398.

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Jul 17 ]

TESTED

Comment by richlv [ 2014 Jul 17 ]

(3) this is a performance improvement - which is nice - thus whatsnew

martins-v Listed in https://www.zabbix.com/documentation/2.2/manual/introduction/whatsnew226#api_improvements. RESOLVED.

<richlv> hmm, let's try to figure out what frontend functionality was actually improved - for example, value referencing in network maps or something...

jelisejev It didn't affect the functionality of the frontend in any way. CLOSED.

Comment by Krists Krigers (Inactive) [ 2014 Jul 17 ]

Issue fixed and merged to:

  • 2.2.6rc1 in r47428.
  • 2.3.3 (trunk) in r47439.
Comment by Pavels Jelisejevs (Inactive) [ 2014 Jul 23 ]

(4) This needs to be documented in the 2.2 API changelog as a breaking change.

jelisejev Updated item reference page:
https://www.zabbix.com/documentation/2.2/manual/api/reference/item/object
https://www.zabbix.com/documentation/2.4/manual/api/reference/item/object

kristsk RESOLVED. See https://www.zabbix.com/documentation/2.2/manual/api/changes_2.2.

jelisejev CLOSED.

Comment by richlv [ 2014 Aug 27 ]

subissues still open : 3, 4

Generated at Fri Apr 26 20:51:22 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.