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

graphprototype.update

Description描述

object graphprototype.update(object/array graphPrototypes)

This method allows to update existing graph prototypes.此方法允许更新已经存在的图形项目。

Parameters参数

(object/array) Graph prototype properties to be updated.(关联数组/数组) 需要更新的图形原型参数。

The graphid property must be defined for each graph prototype, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged. 必须定义每一个图形原型的graphid参数,所有其他的参数都是可选的。只有通过的参数将被更新,其他的参数会保持不变。 Additionally to the standard graph prototype properties, the method accepts the following parameters. 除了标准图形原型参数外,此方法还接受以下参数。

Parameter参数 T pe类型 Des ription描述
gitems array Graph items to replace existing graph items.图形项目将替换已经存在的图形项。 If a graph item has the gitemid property defined it will be updated, otherwise a new graph item will be created.如果定义一个已经存在“gitemid”参数的图形项,那么“gitemid”参数将被更新,否则一个新的图形项将被创建。

Return values返回值

(object) Returns an object containing the IDs of the updated graph prototypes under the graphids property.返回一个关联数组,包含被更新的图片原型的ID参数。

Examples示例

Changing the size of a graph prototype改变一个图形原型的尺寸

Change the size of a graph prototype to 1100 to 400 pixels.将一个图形原型的尺寸修改成宽1100像素高400像素。

Request请求:

{
           "jsonrpc": "2.0",
           "method": "graphprototype.update",
           "params": {
               "graphid": "439",
               "width": 1100,
               "height": 400
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response响应:

{
           "jsonrpc": "2.0",
           "result": {
               "graphids": [
                   "439"
               ]
           },
           "id": 1
       }

Source来源

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