graph.create

描述

object graph.create(object/array graphs)

该方法允许create新图表.

此方法仅适用于管理员超级管理员用户类型. 调用该方法的权限可在用户角色设置中撤销. 更多信息请参阅User roles.

参数

(object/array) 图表至 create.

图表 外, 该方法还接受以下参数。

参数 数据类型 描述
gitems array 为图表创建的Graph items

参数行为:
- 必填

返回值

(object) 返回一个包含所创建图形ID的object,这些ID存储在graphids属性下。返回的ID顺序与传入的图形顺序一致。

示例

创建图表

创建包含两个监控项的图表.

执行请求:

{  "jsonrpc": "2.0",  "method": "graph.create",  "params": {  "name": "MySQL bandwidth",  "width": 900,  "height": 200,  "gitems": [  {  "itemid": "22828",  "color": "00AA00"  },  {  "itemid": "22829",  "color": "3333FF"  }  ]  },  "id": 1 }

响应:

{  "jsonrpc": "2.0",  "result": {  "graphids": [  "652"  ]  },  "id": 1 }

另请参阅

来源

CGraph::create() 位于 ui/include/classes/api/services/CGraph.php 文件中。