描述

    The method allows to retrieve graphs according to the given parameters. 此方法用于根据给定的参数来获取图表。

    Parameters

    参数

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

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

    参数类型描述
    graphidsstring/array仅返回含有给定ID的图表.
    groupidsstring/array仅返回属于给定主机组的主机的图表.
    templateidsstring/array仅返回属于给定模板的图表.
    hostidsstring/array仅返回属于给定主机的图表.
    itemidsstring/array仅返回包含给定监控项的图表.
    templatedboolean如果设置为 真(true),仅返回属于模板的图表.
    inheritedboolean如果设置为 真(true),仅返回从模板继承的图表.
    expandNameflag在图表名称中展开宏.
    selectGroupsquerygroups 属性下,返回图表所属的主机组.
    selectTemplatesquerytemplates 属性下,返回图表所属的模板.
    selectHostsqueryhosts 属性下,返回图表所属的主机.
    selectItemsqueryitems 属性下,返回图表使用的监控项.
    selectGraphDiscoveryquerygraphDiscovery 属性下,返回图表发现对象. 图表发现对象将图表链接到创建它的图表原型.

    它具有以下参数:
    graphid - (string) 图表的ID;
    parent_graphid - (string) 已创建图表的图表原型的ID.
    selectGraphItemsquerygitems 属性下,返回图表所使用的图表监控项.
    selectDiscoveryRulequerydiscoveryRule 属性下,返回创建此图表的低级别发现规则.
    filterobject仅返回完全匹配给定过滤规则的结果.

    接受一个数组,其中键是属性名称,值是单个值或要匹配的值数组.

    支持额外的过滤器:
    host - 图表所属主机的名称;
    hostid - 图表所属主机的ID.
    sortfieldstring/array按给定属性将结果排序.

    可能值: graphid, name and graphtype.
    countOutputboolean以下参数为get方法通常参数,在有详细说明..
    editableboolean
    excludeSearchboolean
    limitinteger
    outputquery
    preservekeysboolean
    searchobject
    searchByAnyboolean
    searchWildcardsEnabledboolean
    sortorderstring/array
    startSearchboolean

    返回值

    (integer/array) Returns either:

    • an array of objects;

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

    (整数/级数) 返回:

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

    Examples

    例子

    Retrieving graphs from hosts

    从主机中获取图表

    Retrieve all graphs from host “10107” and sort them by name. 从主机“10107”中获取所有图表,并依据名称进行排序。

    Request: 请求:

    Response: 响应:

    1. "jsonrpc": "2.0",
    2. "result": [
    3. {
    4. "graphid": "612",
    5. "name": "CPU jumps",
    6. "width": "900",
    7. "height": "200",
    8. "yaxismin": "0.0000",
    9. "yaxismax": "100.0000",
    10. "templateid": "439",
    11. "show_work_period": "1",
    12. "show_triggers": "1",
    13. "graphtype": "0",
    14. "show_legend": "1",
    15. "show_3d": "0",
    16. "percent_left": "0.0000",
    17. "percent_right": "0.0000",
    18. "ymin_type": "0",
    19. "ymax_type": "0",
    20. "ymin_itemid": "0",
    21. "flags": "0"
    22. },
    23. {
    24. "graphid": "613",
    25. "name": "CPU load",
    26. "width": "900",
    27. "height": "200",
    28. "yaxismin": "0.0000",
    29. "yaxismax": "100.0000",
    30. "templateid": "433",
    31. "show_work_period": "1",
    32. "show_triggers": "1",
    33. "graphtype": "0",
    34. "show_legend": "1",
    35. "show_3d": "0",
    36. "percent_left": "0.0000",
    37. "percent_right": "0.0000",
    38. "ymin_type": "1",
    39. "ymax_type": "0",
    40. "ymin_itemid": "0",
    41. "ymax_itemid": "0",
    42. "flags": "0"
    43. },
    44. "graphid": "614",
    45. "name": "CPU utilization",
    46. "width": "900",
    47. "height": "200",
    48. "yaxismin": "0.0000",
    49. "yaxismax": "100.0000",
    50. "templateid": "387",
    51. "show_work_period": "1",
    52. "show_triggers": "0",
    53. "graphtype": "1",
    54. "show_legend": "1",
    55. "show_3d": "0",
    56. "percent_left": "0.0000",
    57. "percent_right": "0.0000",
    58. "ymin_type": "1",
    59. "ymin_itemid": "0",
    60. "ymax_itemid": "0",
    61. "flags": "0"
    62. },
    63. {
    64. "graphid": "645",
    65. "name": "Disk space usage /",
    66. "width": "600",
    67. "height": "340",
    68. "yaxismin": "0.0000",
    69. "yaxismax": "0.0000",
    70. "templateid": "0",
    71. "show_work_period": "0",
    72. "show_triggers": "0",
    73. "graphtype": "2",
    74. "show_legend": "1",
    75. "show_3d": "1",
    76. "percent_left": "0.0000",
    77. "percent_right": "0.0000",
    78. "ymin_type": "0",
    79. "ymax_type": "0",
    80. "ymin_itemid": "0",
    81. "ymax_itemid": "0",
    82. "flags": "4"
    83. }
    84. ],
    85. "id": 1
    86. }

    参考

    Source

    来源

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