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

discoveryrule.update

Description 说明

object discoveryrule.update(object/array lldRules)

This method allows to update existing LLD rules.此方法允许更新现有的LLD规则。

Parameters参数

(object/array) LLD rule properties to be updated.要更新的LLD规则属性。

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

Additionally to the standard LLD rule properties, the method accepts the following parameters. 96/5000 除了标准LLD规则属性之外,该方法接受以下参数。

属性 类 说明
filter object LLD rule filter object to replace the current filter.

Return values 返回值

(object) Returns an object containing the IDs of the updated LLD rules under the itemids property.

Examples 示例

Adding a filter to an LLD rule

Add a filter so that the contents of the {#FSTYPE} macro would match the @File systems for discovery regexp.

Request:

{
           "jsonrpc": "2.0",
           "method": "discoveryrule.update",
           "params": {
               "itemid": "24682",
               "filter": {
                   "evaltype": 1,
                   "conditions": [
                       {
                           "macro": "{#FSTYPE}",
                           "value": "@File systems for discovery"
                       }
                   ]
               }
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

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

Source 来源

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