graph.create

Description描述

object graph.create(object/array graphs)

This method allows to create new graphs.此方法允许创建新的图形。

Parameters参数

(object/array) Graphs to create.(对象/数组) 创建图形.

Additionally to the standard graph properties, the method accepts the following parameters.除标准图形参数外,此方法还接受以下参数。

Parameter参数 T pe类型 Des ription描述
gitems
(required必要)
array数组 G aph items to be created for the graph.创建到图形中的监控项

Return values返回值

(object) Returns an object containing the IDs of the created graphs under the graphids property. The order of the returned IDs matches the order of the passed graphs. (关联数组) 返回一个对象包含,属于所创建的图形下的 graphids参数的ID。 返回的ID的顺序与成功创建的图形的顺序匹配。

Examples示例

Creating a graph创建一个图形

Create a graph with two items.创建一个有两个参数的图形

Request请求:

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

响应:

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

See also参见

Source来源

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