graph.create

Description

描述

object graph.create(object/array **graphs**) 对象 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. 除了 标准图表属性 外,此方法还接受以下参数。

ParameterTypeDescription
gitems
(required)
arrayGraph items to be created for the graph.
参数类型描述
gitems
(必选)
array创建到图表中的监控项.

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: 请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "graph.create",
  4. "params": {
  5. "name": "MySQL bandwidth",
  6. "width": 900,
  7. "height": 200,
  8. "gitems": [
  9. {
  10. "itemid": "22828",
  11. "color": "00AA00"
  12. },
  13. {
  14. "itemid": "22829",
  15. "color": "3333FF"
  16. }
  17. ]
  18. },
  19. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  20. "id": 1
  21. }

Response: 响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "graphids": [
  5. "652"
  6. ]
  7. },
  8. "id": 1
  9. }

See also

参考

Source

来源

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