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.

This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
eventids ID/array Return only problems with the given IDs.
groupids ID/array Return only problems created by objects that belong to the given host groups.
hostids ID/array Return only problems created by objects that belong to the given hosts.
objectids ID/array Return only problems created by the given objects.
source integer Return 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.
object integer Return 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.
acknowledged boolean true - return acknowledged problems only;
false - unacknowledged only.
action integer Return only problems for which the given event update actions have been performed. For multiple actions, use a sum of any acceptable bitmap values as bitmask (for example, 34 for acknowledge and suppress event).
action_userids ID/array Return only problems with the given IDs of users who performed the problem event update actions.
suppressed boolean true - return only suppressed problems;
false - return problems in the normal state.
symptom boolean true - return only symptom problem events;
false - return only cause problem events.
severities integer/array Return only problems with given event severities. Applies only if object is trigger.
evaltype integer Rules for tag searching.

Possible values:
0 - (default) And/Or;
2 - Or.
tags array Return 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;
2 - Not like;
3 - Not equal
4 - Exists;
5 - Not exists.
recent boolean true - return PROBLEM and recently RESOLVED problems (depends on Display OK triggers for N seconds)
Default: false - UNRESOLVED problems only
eventid_from string Return only problems with IDs greater or equal to the given ID.
eventid_till string Return only problems with IDs less or equal to the given ID.
time_from timestamp Return only problems that have been created after or at the given time.
time_till timestamp Return only problems that have been created before or at the given time.
selectAcknowledges query Return an acknowledges property with the problem updates. Problem updates are sorted in reverse chronological order.

The problem update object has the following properties:
acknowledgeid - (ID) ID of the update;
userid - (ID) ID of the user that updated the event;
eventid - (ID) 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;
suppress_until - (timestamp) time till event will be suppressed;
taskid - (ID) ID of the task if the current event is undergoing a rank change.

Supports count.
selectTags query Return a tags property with the problem tags. Output format: [{"tag": "<tag>", "value": "<value>"}, ...].
selectSuppressionData query Return a suppression_data property with the list of active maintenances and manual suppressions:
maintenanceid - (ID) ID of the maintenance;
userid - (ID) ID of user who suppressed the problem;
suppress_until - (integer) time until the problem is suppressed.
filter object Return only those results that exactly match the given filter.

Accepts an object, where the keys are property names, and the values are either a single value or an array of values to match against.

Does not support properties of text data type.
sortfield string/array Sort the result by the given properties.

Possible values: eventid.
countOutput boolean These parameters being common for all get methods are described in detail in the reference commentary page.
editable boolean
excludeSearch boolean
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

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:

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

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "eventid": "1245463",
                   "source": "0",
                   "object": "0",
                   "objectid": "15112",
                   "clock": "1472457242",
                   "ns": "209442442",
                   "r_eventid": "1245468",
                   "r_clock": "1472457285",
                   "r_ns": "125644870",
                   "correlationid": "0",
                   "userid": "1",
                   "name": "Zabbix agent on localhost is unreachable for 5 minutes",
                   "acknowledged": "1",
                   "severity": "3",
                   "cause_eventid": "0",
                   "opdata": "",
                   "acknowledges": [
                       {
                           "acknowledgeid": "14443",
                           "userid": "1",
                           "eventid": "1245463",
                           "clock": "1472457281",
                           "message": "problem solved",
                           "action": "6",
                           "old_severity": "0",
                           "new_severity": "0",
                           "suppress_until": "1472511600",
                           "taskid": "0"
                       }
                   ],
                   "suppression_data": [
                       {
                           "maintenanceid": "15",
                           "suppress_until": "1472511600",
                           "userid": "0"
                       }
                   ],
                   "suppressed": "1",
                   "tags": [
                       {
                           "tag": "test-tag",
                           "value": "test-value"
                       }
                   ]
               }
           ],
           "id": 1
       }

Retrieving problems acknowledged by specified user

Retrieving problems acknowledged by user with ID=10

Request:

{
           "jsonrpc": "2.0",
           "method": "problem.get",
           "params": {
               "output": "extend",
               "action": 2,
               "action_userids": [10],
               "selectAcknowledges": ["userid", "action"],
               "sortfield": ["eventid"],
               "sortorder": "DESC"
           },
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "eventid": "1248566",
                   "source": "0",
                   "object": "0",
                   "objectid": "15142",
                   "clock": "1472457242",
                   "ns": "209442442",
                   "r_eventid": "1245468",
                   "r_clock": "1472457285",
                   "r_ns": "125644870",
                   "correlationid": "0",
                   "userid": "10",
                   "name": "Zabbix agent on localhost is unreachable for 5 minutes",
                   "acknowledged": "1",
                   "severity": "3",
                   "cause_eventid": "0",
                   "opdata": "",
                   "acknowledges": [
                       {
                           "userid": "10",
                           "action": "2"
                       }
                   ],
                   "suppressed": "0"
               }
           ],
           "id": 1
       }

See also

Source

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