[ZBX-16901] event.get returns empty response since 4.2 -> 4.4 upgrade Created: 2019 Nov 12  Updated: 2024 Apr 10  Resolved: 2020 Jan 15

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 4.4.0, 4.4.1
Fix Version/s: 4.4.5rc1, 5.0.0alpha1, 5.0 (plan)

Type: Problem report Priority: Minor
Reporter: Grant Ashton Assignee: Valdis Murzins
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu Xenial, MySQL, 4.4.1


Issue Links:
Causes
caused by ZBXNEXT-4942 Final fix for {ITEM.LASTVALUE1} in Mo... Closed
Team: Team B
Sprint: Sprint 60 (Jan 2020)
Story Points: 0.125

 Description   
my $events = $self->{'api'}->do('event.get', {
    'selectTags'          => "extend",
    'selectRelatedObject' => "extend",
    'selectHosts'         => "extend",
    'select_acknowledges' => "extend",
    'tags'                => [ { "tag" => "Ticket", "value" => "Y", "operator" => 1 } ],
    'source'              => 0,
    'value'               => 1,
});

Using Zabbix::Tiny perl module interface.

Since upgrading from 4.2.0 -> 4.4.1 this request now fails with an empty response being received from the Zabbix Server.

Other API requests still working as expected.

 



 Comments   
Comment by Grant Ashton [ 2019 Nov 12 ]

Raw request:

{
  "auth": "xxxxxxxxx",
  "id": 2,
  "method": "event.get",
  "jsonrpc": "2.0",
  "params": {
    "tags": [
      {
        "operator": 1,
        "value": "Y",
        "tag": "Ticket"
      }
    ],
    "value": 1,
    "selectRelatedObject": "extend",
    "select_acknowledges": "extend",
    "selectHosts": "extend",
    "selectTags": "extend",
    "source": 0
  }
}

Raw Response is empty, due to 500 Internal Server Error

Comment by richlv [ 2019 Nov 14 ]

500 should have an entry in the Apache error log - is it perhaps running out of memory or timing out?

Comment by Grant Ashton [ 2019 Nov 14 ]

Well it makes sense it was caused by 4.4, as the error relates to the new Operational Data in the triggers. This same error is happening consistently on all 4 Zabbix instances, all with the same templates.

PHP Fatal error: Uncaught TypeError: Argument 1 passed to CMacrosResolverHelper::resolveTriggerOpdata() must be of the type array, null given, called in /usr/share/zabbix/include/classes/api/services/CEvent.php on line 923 and defined in /usr/share/zabbix/include/classes/macros/CMacrosResolverHelper.php:231\nStack trace:\n#0 /usr/share/zabbix/include/classes/api/services/CEvent.php(923): CMacrosResolverHelper::resolveTriggerOpdata(NULL, Array)\n#1 /usr/share/zabbix/include/classes/api/services/CEvent.php(176): CEvent->addRelatedObjects(Array, Array)\n#2 /usr/share/zabbix/include/classes/api/clients/CLocalApiClient.php(123): CEvent->get(Array)\n#3 /usr/share/zabbix/include/classes/core/CJsonRpc.php(88): CLocalApiClient->callMethod('event', 'get', Array, '09df76185dda54d...')\n#4 /usr/share/zabbix/api_jsonrpc.php(63): CJsonRpc->execute()\n#5 {main}\n thrown in /usr/share/zabbix/include/classes/macros/CMacrosResolverHelper.php on line 231
Comment by Grant Ashton [ 2020 Jan 02 ]

Any update on when this will be fixed?

The API for event.get is completely broken in 4.4, I would expect this to be a higher priority...

Comment by Valdis Murzins [ 2020 Jan 06 ]

The problem was reproduced when both following conditions are met:
1. In event.get API request, output should contain "opdata". ("extend" also includes it)
2. Within requested events, there should be an event with nonexistent trigger (for example, when you are deleting trigger, its events will be deleted at later time).

This issue in event.get will be fixed in next release. In meantime, as a workaround you can omit "opdata" from output. It can be done by specifying other properties (preferably only ones, you are interested in) manually. Names of these properties can be found in documentation
Example:

{
  "method": "event.get",
  "jsonrpc": "2.0",
  "params": {
    "output": ["eventid", "source", "object", "objectid", "acknowledged", "clock", "ns", "name", "value", "severity", "r_eventid", "c_eventid", "correlationid", "userid", "suppressed", "urls"],
    ...
  }
  ...
}
Comment by Valdis Murzins [ 2020 Jan 07 ]

Fixed in development branch feature/ZBX-16901-4.4

Comment by Grant Ashton [ 2020 Jan 07 ]

Thank you very much Vladis for the detailed explanation, workaround and fix.

It has solved the issue for us.

Comment by Valdis Murzins [ 2020 Jan 10 ]

Fixed in:

Generated at Mon May 05 07:11:30 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.