这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.
2022 Zabbix中国峰会
2022 Zabbix中国峰会

2.graphprototype.create

描述

对象 graphprototype.create(object/array graphPrototypes)

此方法用于创建新的图表原型。

参数

(对象/数组) 将要创建的图表原型。

除了标准图表原型参数外, 此方法还接受以下参数:

参数 类 描述
gitems
(必选)
array 创建到图表原型中的图表监控项。图表监控项能同时被监控项与监控项原型检索到,但必须至少有一个监控项原型。

返回值

(对象)graphids属性下,返回一个包含已被创建的图表原型ID的对象。返回的ID的顺序与传递的图表原型的顺序相匹配。

示例

创建一个图表原型

创建一个含有两个监控项的图表原型。

请求:

{
           "jsonrpc": "2.0",
           "method": "graphprototype.create",
           "params": {
               "name": "Disk space usage {#FSNAME}",
               "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
       }

参考

来源

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