object discoveryrule.update(object/array lldRules)
此方法允许更新已存在的LLD规则。
(object/array) 要更新的LLD规则属性。
每个LLD规则的itemid属性必须被定义,其他属性为可选。值传递要被更新的属性,其他属性保持不变。
另外见标准的LLD规则属性,此方法接受如下参数。
| 属性 类 | 描述 | |
|---|---|---|
| filter | object | LLD规则LLD规则的过滤对象。 |
| preprocessing | array | LLD规则预处理选项。 |
| lld_macro_paths | array | LLD规则预处理选项。 |
| overrides | array | LLD规则覆盖选项。 |
(object)在itemids属性下返回一个包含被更新的LLD规则的IDs。
添加一个过滤器,以便{#FSTYPE}宏的内容与lld发现规则 @File systems for discovery的正则表达式匹配。
请求:
{ "jsonrpc": "2.0", "method": "discoveryrule.update", "params": { "itemid": "22450", "filter": { "evaltype": 1, "conditions": [ { "macro": "{#FSTYPE}", "value": "@File systems for discovery" } ] } }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }响应:
禁用LLD trapping 发现规则。
请求:
{ "jsonrpc": "2.0", "method": "discoveryrule.update", "params": { "itemid": "22450", "lld_macro_paths": [ { "lld_macro": "{#MACRO1}", "path": "$.json.path" } ] }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }响应:
CDiscoveryRule::update() in frontends/php/include/classes/api/services/CDiscoveryRule.php.
Update an LLD rule with preprocessing rule “JSONPath”.
Request:
{ "jsonrpc": "2.0", "method": "discoveryrule.update", "params": { "itemid": "44211", "preprocessing": [ { "type": "12", "params": "$.path.to.json", "error_handler": "2", "error_handler_params": "5" } ] }, "auth": "700ca65537074ec963db7efabda78259", "id": 1 }Response:
CDiscoveryRule::update() in ui/include/classes/api/services/CDiscoveryRule.php.