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

item.update

Description 说明

object item.update(object/array items)

This method allows to update existing items.此方法允许更新现有项

Web items cannot be updated via the Zabbix API.Web项无法通过Zabbix API进行更新。

Parameters 参数

(object/array) Item properties to be updated.要更新的 Item属性。

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

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

属性 类 说明
applications array IDs of the applications to replace the current applications.用于替换当前应用程序的应用程序的ID。

Return values 返回值

(object) Returns an object containing the IDs of the updated items under the itemids property.返回一个包含“itemids”属性下更新项的ID的对象。

Examples 示例

Enabling an item 启用项

Enable an item, that is, set its status to "0".启用项,即将其状态设置为“0”。

Request:

{
           "jsonrpc": "2.0",
           "method": "item.update",
           "params": {
               "itemid": "10092",
               "status": 0
           },
           "auth": "700ca65537074ec963db7efabda78259",
           "id": 1
       }

Response:

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

Source 来源

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