获取

Description 描述

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

The method allows to retrieve problems according to the given parameters. 此方法允许根据给定参数检索符合条件的问题

Parameters 参数

(object) Parameters defining the desired output. (object) 定义所需输出的参数

The method supports the following parameters. 此方法支持一下参数

ParameterTypeDescription
eventidsstring/arrayReturn only problems with the given IDs. 仅返回所给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. 只返回给定类型的问题

跳转到problem event object page 用于支持事件类型的列表。
\默认:0 - 触发器创建的问题
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. 只返回由给定类型的对象创建的问题
\跳转到 problem event object page 用于支持事件类型的列表
\默认:0-触发器
acknowledgedbooleantrue - return acknowledged problems only;
false - unacknowledged only. true-返回已知晓的问题
返回未知晓的问题
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. 规则标签搜索。
\可能的值:
0 - (默认)与/或 ;2 - 或
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. 只返回给定标签的问题。按标记精确匹配,按值和运算符不区分大小写搜索。
格式:[{“tag”: “<tag>”, “value”: “<value>”, “operator”: “<operator>”}, …].
空数组返回所有问题

可能的分隔类型:
0 - (默认) 相似 1 - 相等
recentstringtrue - return PROBLEM and recently RESOLVED problems (depends on Display OK triggers for N seconds)
Default: false - UNRESOLVED problems only true - 返回问题和最近已解决的问题(依赖于最近N秒显示OK的触发器)
默认:false - 仅真正未处理的问题
eventid_fromstringReturn only problems with IDs greater or equal to the given ID. 只返回ID大于或等于给定ID的问题。
eventid_tillstringReturn only problems with IDs less or equal to the given ID. 只返回ID小于或等于给定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. 仅返回问题创建时间在所给时间之前的问题
selectAcknowledgesquery

Examples 示例如下

Retrieving trigger problem events 返回触发器问题事件

Retrieve recent events from trigger “15112.” 返回最近触发器id是15112的事件

Request:

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

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. "acknowledges": [
  20. {
  21. "acknowledgeid": "14443",
  22. "userid": "1",
  23. "eventid": "1245463",
  24. "clock": "1472457281",
  25. "message": "problem solved",
  26. "action": "6",
  27. "old_severity": "0",
  28. "new_severity": "0"
  29. }
  30. ],
  31. "tags": [
  32. {
  33. "tag": "test tag",
  34. "value": "test value"
  35. }
  36. ]
  37. }
  38. ],
  39. "id": 1
  40. }

See also

Source

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