graphitem.get

Description

描述

integer/array graphitem.get(object **parameters**) 整数/数组 graphitem.get(object **parameters**)

The method allows to retrieve graph items according to the given parameters. 此方法用于根据给定参数来获取图表监控项。

Parameters

参数

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

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

ParameterTypeDescription
gitemidsstring/arrayReturn only graph items with the given IDs.
graphidsstring/arrayReturn only graph items that belong to the given graphs.
itemidsstring/arrayReturn only graph items with the given item IDs.
typeintegerReturn only graph items with the given type.

Refer to the graph item object page for a list of supported graph item types.
selectGraphsqueryReturn the graph that the item belongs to as an array in the graphs property.
sortfieldstring/arraySort the result by the given properties.

Possible values are: gitemid.
countOutputbooleanThese parameters being common for all get methods are described in detail in the reference commentary page.
editableboolean
limitinteger
outputquery
preservekeysboolean
sortorderstring/array
参数类型描述
gitemidsstring/array仅返回给定ID的图表监控项
graphidsstring/array仅返回属于给定图表的图表监控项
itemidsstring/array仅返回具有给定监控项ID的图表监控项
typeinteger仅返回给定类型的图表监控项

有关支持的图表监控项的类型,请参考图表监控项对象.
selectGraphsquerygraphs(图表)属性下,以数组的形式返回监控项所属的图表
sortfieldstring/array根据给定属性对结果进行排序.

可能值: gitemid.
countOutputboolean以下参数为get方法通常参数,在参考注释有详细说明.
editableboolean
limitinteger
outputquery
preservekeysboolean
sortorderstring/array

Return values

返回值

(integer/array) Returns either:

  • an array of objects;

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

(整数/数组) 返回:

  • 一个数组对象;

  • 如果使用了 countOutput 参数,返回获取的对象的数量.

Examples

例子

Retrieving graph items from a graph

从图表中获取图表监控项

Retrieve all graph items used in a graph with additional information about the item and the host. 获取图表中使用的所有图表监控项以及有关项目和主机的其他信息

Request: 请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "graphitem.get",
  4. "params": {
  5. "output": "extend",
  6. "graphids": "387"
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 1
  10. }

Response: 响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "gitemid": "1242",
  6. "graphid": "387",
  7. "itemid": "22665",
  8. "drawtype": "1",
  9. "sortorder": "1",
  10. "color": "FF5555",
  11. "yaxisside": "0",
  12. "calc_fnc": "2",
  13. "type": "0",
  14. "key_": "system.cpu.util[,steal]",
  15. "hostid": "10001",
  16. "flags": "0",
  17. "host": "Template OS Linux"
  18. },
  19. {
  20. "gitemid": "1243",
  21. "graphid": "387",
  22. "itemid": "22668",
  23. "drawtype": "1",
  24. "sortorder": "2",
  25. "color": "55FF55",
  26. "yaxisside": "0",
  27. "calc_fnc": "2",
  28. "type": "0",
  29. "key_": "system.cpu.util[,softirq]",
  30. "hostid": "10001",
  31. "flags": "0",
  32. "host": "Template OS Linux"
  33. },
  34. {
  35. "gitemid": "1244",
  36. "graphid": "387",
  37. "itemid": "22671",
  38. "drawtype": "1",
  39. "sortorder": "3",
  40. "color": "009999",
  41. "yaxisside": "0",
  42. "calc_fnc": "2",
  43. "type": "0",
  44. "key_": "system.cpu.util[,interrupt]",
  45. "hostid": "10001",
  46. "flags": "0",
  47. "host": "Template OS Linux"
  48. }
  49. ],
  50. "id": 1
  51. }

See also

参考

Source

来源

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