2

I am trying to create a Custom Report in Zabbix Web Portal using a Zabbix API v4.0. In order to calculate the server's MTTR & MTBF value, we require Problem & Maintenance data. We tried to get Problems through this API. But the result is always empty (No data in Response).

Following is my Request Payload:

{ "jsonrpc": "2.0", "method": "problem.get", "params": { "output": "extend", "selectAcknowledges": "extend", "selectTags": "extend", "selectSuppressionData": "extend", "objectids": "16580", "recent": "true", "sortfield": ["eventid"], "sortorder": "DESC" }, "auth": "67f45d3eb1173338e1b1647c4bdc1916", "id": 1 }

NOTE:
- In the payload 16580 is the trigger that we have received through the Event API for the X event.

Using the same X event we are getting multiple problems when we are trying to use a default Zabbix function.
$eventids = array_column($events, 'eventid'); $CScreenProblem = new CScreenProblem(); $problems = $CScreenProblem->getExDataEvents($eventids);

The same host, the same event has multiple problems data using above default function but unfortunately, with API it returns blank.

If anyone can help me to find what is wrong in the API Request payload? That would be a great help.

Nirav Dangi
  • 3,607
  • 4
  • 49
  • 60

1 Answers1

0

From the problem API doc:

This method is for retrieving unresolved problems. It is also possible, if specified, to additionally retrieve recently resolved problems. The period that determines how old is “recently” is defined in Administration → General. Problems that were resolved prior to that period are not kept in the problem table. To retrieve problems that were resolved further back in the past, use the event.get method.

So if your trigger id 16580 isn't active at the moment, you'll get an empty response.

For a list of closed problems, use the event.get API with source = 0 (event created by a trigger)

Simone Zabberoni
  • 2,024
  • 1
  • 10
  • 15