2022 Zabbix中国峰会
2022 Zabbix中国峰会

创建

Description 说明

object templatescreen.create(object/array templateScreens)

This method allows to create new template screens. 此方法允许创建新的聚合图形模板。

Parameters 参数

(object/array) Template screens to create. (object/array)要创建的聚合图形模板。

Additionally to the standard template screen properties, the method accepts the following parameters. 除standard template screen properties之外,该方法接受以下参数。

Parameter 参数 T pe 类型 Des ription 说明
screenitems array 数组 T mplate screen items to create on the screen. 聚合图形上要创建的聚合图形模板项。

Return values 返回值

(object) Returns an object containing the IDs of the created template screens under the screenids property. The order of the returned IDs matches the order of the passed template screens. (object)返回一个对象,该对象包含在screenids属性中已创建聚合图形模板ID,返回ID的顺序与传递聚合图形模板的顺序相匹配。

Examples 范例

Create a template screen 创建聚合图形模板

Create a template screen named “Graphs” with 2 rows and 3 columns and add a graph to the upper-left cell. 创建一个2行3列名为“Graphs”的聚合图形模板,并添加一个图形到左上角的格子内。

Request 请求:

{
           "jsonrpc": "2.0",
           "method": "templatescreen.create",
           "params": {
               "name": "Graphs",
               "templateid": "10047",
               "hsize": 3,
               "vsize": 2,
               "screenitems": [
                   {
                       "resourcetype": 0,
                       "resourceid": "410",
                       "x": 0,
                       "y": 0
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response 响应:

{
           "jsonrpc": "2.0",
           "result": {
               "screenids": [
                   "45"
               ]
           },
           "id": 1
       }

See also 参考

Source 源码

CTemplateScreen::create() in frontends/php/include/classes/api/services/CTemplateScreen.php. CTemplateScreen::create()方法可在frontends/php/include/classes/api/services/CTemplateScreen.php中参考。