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

itemprototype.update

Description 说明

object itemprototype.update(object/array itemPrototypes)

This method allows to update existing item prototypes.此方法允许更新现有item prototypes。

Parameters 参数

(object/array) Item prototype properties to be updated.

The itemid property must be defined for each item prototype, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged.必须为每个项目原型定义“itemid”属性,所有其他属性都是可选的。 只有通过的属性将被更新,所有其他属性将保持不变。

Additionally to the standard item prototype properties, the method accepts the following parameters.除标准项原型属性外,该方法还接受以下参数。

属性 类 说明
applications array IDs of the applications to replace the current applications.
applicationPrototypes array Names of the application prototypes to replace the current application prototypes.

Return values 返回值

(object) Returns an object containing the IDs of the updated item prototypes under the itemids property.返回包含“itemid”属性下更新的项目原型的ID的对象。

Examples 示例

Changing the interface of an item prototype

Change the host interface that will be used by discovered items.

Request:

{
           "jsonrpc": "2.0",
           "method": "itemprototype.update",
           "params": {
               "itemid": "27428",
               "interfaceid": "132"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "itemids": [
                   "27428"
               ]
           },
           "id": 1
       }

Source 来源

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