integer/array graph.get(object parameters)
The method allows to retrieve graphs according to the given parameters. 此方法允许根据给定的参数返回图形
(object) Parameters defining the desired output. (对象) 参数定义需要的输出。
The method supports the following parameters. 此方法支持如下参数
| Parameter参数 T | pe类型 Des | ription描述 |
|---|---|---|
| 图形ID graphids s | ring/array 字符串型/数组型 Return o | ly graphs with the given IDs.返回只含有指定ID的图形 |
| 主机组ID groupids st | ing/array 字符串型/数组型 Return on | y graphs that belong to hosts in the given host groups.返回只属于指定主机组的主机的的图形。 |
| 模板ID templateids s | ring/array 字符串型/数组型 Return o | ly graph that belong to the given templates.返回只属于指定模板的图形。 |
| 主机ID hostids s | ring/array 字符串型/数组型 Return o | ly graphs that belong to the given hosts.返回只属于指定主机的图形。 |
| 监控项ID itemids st | ing/array 字符串型/数组型 Return on | y graphs that contain the given items.返回只包含指定监控项的图形。 |
| 模板化的 templated boo | ean 布尔型 If set | to true return only graphs that belong to templates.如果设置“true”返回只属于模板的图形。 |
| 继承的 inherited bo | lean 布尔型 If se | to true return only graphs inherited from a template.如果设置“true”只返回从模板继承的图形。 |
| 展开名称 expandName fla | 标记 Expan | macros in the graph name.展开图形名称中的宏。 |
| 选择组 selectGroups qu | ry 询问 Retu | n the host groups that the graph belongs to in the groups property.返回图形的“groups”参数的主机组。 |
| 选择模板 selectTemplates que | y 询问 Retur | the templates that the graph belongs to in the templates property.返回图形的“templates”参数的模板。 |
| 选择主机 selectHosts que | y 询问 Retur | the hosts that the graph belongs to in the hosts property.返回图形的“hosts”参数的主机。 |
| 选择监控项 selectItems quer | 询问 Return | the items used in the graph in the items property.返回图形的“items”参数的监控项。 |
| 选择图形发现 selectGraphDiscovery query | 询问 Return | he graph discovery object in the graphDiscovery property. The graph discovery objects links the graph to a graph prototype from which it was created.返回在graphDiscovery参数中图形发现对象。图型发现对象链接图形与创建父图形的参数。It has the following properties:它接受以下参数 graphid - (string) ID of the graph;图形ID graphid - (string字符串型) 图形ID;parent_graphid - (string) ID of the graph prototype from which the graph has been created.父图形ID parent_graphid - (string字符串型) 父图形的ID |
| 选择图形项 selectGraphItems quer | 询问 Return | the graph items used in the graph in the gitems property.返回图形的“gitems”参数的监控项。 |
| 选择发现规则 selectDiscoveryRule query | 询问 Return | he low-level discovery rule that created the graph in the discoveryRule property.返回创建图形的“discoverRule”参数中的低级发现规则。 |
| 过滤器 filter ob | ect 关联数组 Return | only those results that exactly match the given filter. 只返回与给定过滤器完全匹配的结果。 Accepts an array, where the keys are property names, and the values are either a single value or an array of values to match against. 接受一个数组,其中的键是属性名,值可以是一个值或者是一个匹配的值数组。 Supports additional filters: 支持额外过滤器: host - technical name of the host that the graph belongs to;图形所属主机的名称hostid - ID of the host that the graph belongs to.图形所属主机的ID |
| 排序域 sortfield st | ing 字符串型/array数组 Sort the | result by the given properties.按指定的参数将结果排序 Possible values are:可用值 图形ID graphid, 名称 name and 图形类型 graphtype. |
| countOutput | flag | These parameters being common for all get methods are described in detail in the reference commentary page. 这些参数对于所有get方法都是通用的,在附录1:参考中,查看详细描述。 |
| editable | boolean | |
| excludeSearch | flag | |
| limit | integer | |
| output | query | |
| preservekeys | flag | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | flag |
(integer整数/array数组) Returns either返回两个中的一个:
countOutput parameter has been used.如果countOutput参数被使用,将对检索到的对象进行计数。Retrieve all graphs from host "10107" and sort them by name. 获取所有主机“10107”所有图形并对他们按名称排列。
Request请求:
{
"jsonrpc": "2.0",
"method": "graph.get",
"params": {
"output": "extend",
"hostids": 10107,
"sortfield": "name"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}Response响应:
{
"jsonrpc": "2.0",
"result": [
{
"graphid": "612",
"name": "CPU jumps",
"width": "900",
"height": "200",
"yaxismin": "0.0000",
"yaxismax": "100.0000",
"templateid": "439",
"show_work_period": "1",
"show_triggers": "1",
"graphtype": "0",
"show_legend": "1",
"show_3d": "0",
"percent_left": "0.0000",
"percent_right": "0.0000",
"ymin_type": "0",
"ymax_type": "0",
"ymin_itemid": "0",
"ymax_itemid": "0",
"flags": "0"
},
{
"graphid": "613",
"name": "CPU load",
"width": "900",
"height": "200",
"yaxismin": "0.0000",
"yaxismax": "100.0000",
"templateid": "433",
"show_work_period": "1",
"show_triggers": "1",
"graphtype": "0",
"show_legend": "1",
"show_3d": "0",
"percent_left": "0.0000",
"percent_right": "0.0000",
"ymin_type": "1",
"ymax_type": "0",
"ymin_itemid": "0",
"ymax_itemid": "0",
"flags": "0"
},
{
"graphid": "614",
"name": "CPU utilization",
"width": "900",
"height": "200",
"yaxismin": "0.0000",
"yaxismax": "100.0000",
"templateid": "387",
"show_work_period": "1",
"show_triggers": "0",
"graphtype": "1",
"show_legend": "1",
"show_3d": "0",
"percent_left": "0.0000",
"percent_right": "0.0000",
"ymin_type": "1",
"ymax_type": "1",
"ymin_itemid": "0",
"ymax_itemid": "0",
"flags": "0"
},
{
"graphid": "645",
"name": "Disk space usage /",
"width": "600",
"height": "340",
"yaxismin": "0.0000",
"yaxismax": "0.0000",
"templateid": "0",
"show_work_period": "0",
"show_triggers": "0",
"graphtype": "2",
"show_legend": "1",
"show_3d": "1",
"percent_left": "0.0000",
"percent_right": "0.0000",
"ymin_type": "0",
"ymax_type": "0",
"ymin_itemid": "0",
"ymax_itemid": "0",
"flags": "4"
}
],
"id": 1
}CGraph::get() in frontends/php/include/classes/api/services/CGraph.php.