object item.update(object/array items)
This method allows to update existing items.
Web items cannot be updated via the Zabbix API.
This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.
(object/array)
Item properties to be updated.
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.
Additionally to the standard item properties, the method accepts the following parameters.
Parameter | Type | Description |
---|---|---|
preprocessing | array | Item preprocessing options to replace the current preprocessing options. Parameter behavior: - read-only for inherited objects or discovered objects |
tags | array | Item tags. Parameter behavior: - read-only for discovered objects |
(object)
Returns an object containing the IDs of the updated items under the itemids
property.
Enable an item, that is, set its status to "0".
{
"jsonrpc": "2.0",
"method": "item.update",
"params": {
"itemid": "10092",
"status": 0
},
"id": 1
}
Response:
Update Dependent item name and Master item ID. Only dependencies on same host are allowed, therefore Master and Dependent item should have same hostid.
{
"jsonrpc": "2.0",
"method": "item.update",
"params": {
"name": "Dependent item updated name",
"master_itemid": "25562",
"itemid": "189019"
},
"id": 1
}
Response:
Enable item value trapping.
{
"jsonrpc": "2.0",
"method": "item.update",
"params": {
"itemid": "23856",
"allow_traps": 1
},
"id": 1
}
Response:
Update an item with item preprocessing rule "In range".
{
"jsonrpc": "2.0",
"method": "item.update",
"params": {
"itemid": "23856",
"preprocessing": [
{
"type": 13,
"params": "\n100",
"error_handler": 1,
"error_handler_params": ""
}
]
},
"id": 1
}
Response:
Update a script item with a different script and remove unnecessary parameters that were used by previous script.
{
"jsonrpc": "2.0",
"method": "item.update",
"params": {
"itemid": "23865",
"parameters": [],
"script": "Zabbix.log(3, 'Log test');\nreturn 1;"
},
"id": 1
}
Response:
CItem::update() in ui/include/classes/api/services/CItem.php.