graphprototype.create

Description描述

object graphprototype.create(object/array graphPrototypes)

This method allows to create new graph prototypes.这个方法用于创建新的图形原型

Parameters参数

(object/array) Graph prototypes to create.(关联数组/数组)创建图形原型

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

Parameter参数 Type类型 Description描述
gitems(required必要) array数组 Graph items to be created for the graph prototypes.创建到图形原型中的监控项 Graph items can reference both items and item prototypes, but at least one item prototype must be present.图形监控项能同时被监控项与监控项原型检索到,但必须至少有一个监控项原型。

Return values可用值

(object) Returns an object containing the IDs of the created graph prototypes under the graphids property. The order of the returned IDs matches the order of the passed graph prototypes.返回一个包含所创建的图形原型的ID的关联数组在graphids 参数下。返回的ID的顺序与通过的图形原型项匹配。

Examples示例

Creating a graph prototype创建一个图形原型

Create a graph prototype with two items.创建一个含有两个监控项的图形原型

Request请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "graphprototype.create",
  4. "params": {
  5. "name": "Disk space usage {#FSNAME}",
  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来源

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