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

更新

Description 说明

object templatescreen.update(object/array templateScreens)

This method allows to update existing template screens. 此方法允许更新现有的聚合图形模板。

Parameters 参数

(object/array) Template screen properties to be updated. (object/array)需要更新的聚合图形模板属性。 The screenid property must be defined for each template screen, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged. 必须为每个聚合图形模板定义screenid属性,所有其他属性为可选项。只有通过的属性会被更新,所有其他属性将保持不变。 Additionally to the standard template screen properties, the method accepts the following parameters. 除standard template screen properties之外,该方法接受以下参数。

Parameter 参数 T pe 类型 Des ription 说明
screenitems array 数组 S reen items to replace existing screen items. 用来替换现有内容的聚合图形项。

Screen items are updated by coordinates, so each screen item must have the x and y properties defined. 聚合图形项通过坐标轴更新,因此每个聚合图形项必须定义xy属性。

Return values 返回值

(object) Returns an object containing the IDs of the updated template screens under the screenids property. (object)返回一个对象,该对象包含在screenids属性中已更新聚合图形模板的ID。

Examples 范例

Rename a template screen 重命名聚合图形模板

Rename the template screen to "Performance graphs". 将聚合图形模板重命名为"Performance graphs"。

Request 请求:

{
           "jsonrpc": "2.0",
           "method": "templatescreen.update",
           "params": {
               "screenid": "3",
               "name": "Performance graphs"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response 响应:

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

Source 源码

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