problem.get

Description

integer/array problem.get(object **parameters**)

The method allows to retrieve problems according to the given parameters.

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 AdministrationGeneral. 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.

This method may return problems of a deleted entity if these problems have not been removed by the housekeeper yet.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

ParameterTypeDescription
eventidsstring/arrayReturn only problems with the given IDs.
groupidsstring/arrayReturn only problems created by objects that belong to the given host groups.
hostidsstring/arrayReturn only problems created by objects that belong to the given hosts.
objectidsstring/arrayReturn only problems created by the given objects.
applicationidsstring/arrayReturn only problems created by objects that belong to the given applications. Applies only if object is trigger or item.
sourceintegerReturn only problems with the given type.

Refer to the problem event object page for a list of supported event types.

Default: 0 - problem created by a trigger.
objectintegerReturn only problems created by objects of the given type.

Refer to the problem event object page for a list of supported object types.

Default: 0 - trigger.
acknowledgedbooleantrue - return acknowledged problems only;
false - unacknowledged only.
suppressedbooleantrue - return only suppressed problems;
false - return problems in the normal state.
severitiesinteger/arrayReturn only problems with given event severities. Applies only if object is trigger.
evaltypeintegerRules for tag searching.

Possible values:
0 - (default) And/Or;
2 - Or.
tagsarray of objectsReturn only problems with given tags. Exact match by tag and case-insensitive search by value and operator.
Format: [{“tag”: “<tag>”, “value”: “<value>”, “operator”: “<operator>”}, …].
An empty array returns all problems.

Possible operator types:
0 - (default) Like;
1 - Equal.
recentbooleantrue - return PROBLEM and recently RESOLVED problems (depends on Display OK triggers for N seconds)
Default: false - UNRESOLVED problems only
eventid_fromstringReturn only problems with IDs greater or equal to the given ID.
eventid_tillstringReturn only problems with IDs less or equal to the given ID.
time_fromtimestampReturn only problems that have been created after or at the given time.
time_tilltimestampReturn only problems that have been created before or at the given time.
selectAcknowledgesqueryReturn an acknowledges property with the problem updates. Problem updates are sorted in reverse chronological order.

The problem update object has the following properties:
acknowledgeid - (string) update’s ID;
userid - (string) ID of the user that updated the event;
eventid - (string) ID of the updated event;
clock - (timestamp) time when the event was updated;
message - (string) text of the message;
action - (integer)type of update action (see event.acknowledge);
old_severity - (integer) event severity before this update action;
new_severity - (integer) event severity after this update action;

Supports count.
selectTagsqueryReturn a tags property with the problem tags. Output format: [{“tag”: “<tag>”, “value”: “<value>”}, …].
selectSuppressionDataqueryReturn a suppression_data property with the list of maintenances:
maintenanceid - (string) ID of the maintenance;
suppress_until - (integer) time until the problem is suppressed.
sortfieldstring/arraySort the result by the given properties.

Possible values are: eventid.
countOutputbooleanThese parameters being common for all get methods are described in detail in the reference commentary page.
editableboolean
excludeSearchboolean
filterobject
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

Return values

(integer/array) Returns either:

  • an array of objects;

  • the count of retrieved objects, if the countOutput parameter has been used.

Examples

Retrieving trigger problem events

Retrieve recent events from trigger “15112.”

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "problem.get",
  4. "params": {
  5. "output": "extend",
  6. "selectAcknowledges": "extend",
  7. "selectTags": "extend",
  8. "selectSuppressionData": "extend",
  9. "objectids": "15112",
  10. "recent": "true",
  11. "sortfield": ["eventid"],
  12. "sortorder": "DESC"
  13. },
  14. "auth": "67f45d3eb1173338e1b1647c4bdc1916",
  15. "id": 1
  16. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "eventid": "1245463",
  6. "source": "0",
  7. "object": "0",
  8. "objectid": "15112",
  9. "clock": "1472457242",
  10. "ns": "209442442",
  11. "r_eventid": "1245468",
  12. "r_clock": "1472457285",
  13. "r_ns": "125644870",
  14. "correlationid": "0",
  15. "userid": "1",
  16. "name": "Zabbix agent on localhost is unreachable for 5 minutes",
  17. "acknowledged": "1",
  18. "severity": "3",
  19. "opdata": "",
  20. "acknowledges": [
  21. {
  22. "acknowledgeid": "14443",
  23. "userid": "1",
  24. "eventid": "1245463",
  25. "clock": "1472457281",
  26. "message": "problem solved",
  27. "action": "6",
  28. "old_severity": "0",
  29. "new_severity": "0"
  30. }
  31. ],
  32. "suppression_data": [
  33. {
  34. "maintenanceid": "15",
  35. "suppress_until": "1472511600"
  36. }
  37. ],
  38. "suppressed": "1",
  39. "tags": [
  40. {
  41. "tag": "test tag",
  42. "value": "test value"
  43. }
  44. ]
  45. }
  46. ],
  47. "id": 1
  48. }

See also

Source

CEvent::get() in ui/include/classes/api/services/CProblem.php.