更新
此方法更新已存在的LLD规则。
此方法只有 Admin(管理员) 和 Super admin(超级管理员) 用户可用。可以在用户角色设置中撤销调用该方法的权限。更多信息请查看。
(object/array)
需要更新的 LLD 规则属性。
必须为每个 LLD 规则定义“itemid”属性,所有其他属性都是可选的。只有传递的属性将被更新,所有其他的将保持不变。
除了 ,该方法还接受以下参数。
(object)
返回一个对象,其中包含 itemids
属性下更新的 LLD 规则的 ID。
LLD 规则添加过滤器
请求:
响应:
{
"jsonrpc": "2.0",
"result": {
"itemids": [
"22450"
]
},
"id": 1
}
添加LLD宏路径
请求:
{
"jsonrpc": "2.0",
"method": "discoveryrule.update",
"params": {
"lld_macro_paths": [
{
"lld_macro": "{#MACRO1}",
"path": "$.json.path"
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
响应:
禁止 trapping
禁止自动发现规则trapping。
请求:
{
"jsonrpc": "2.0",
"method": "discoveryrule.update",
"params": {
"itemid": "28336",
"allow_traps": "0"
},
"id": 36,
"auth": "d678e0b85688ce578ff061bd29a20d3b"
}
{
"jsonrpc": "2.0",
"result": {
"28336"
]
"id": 36
}
更新LLD规则预处理选项
使用预处理规则“JSONPath”更新LLD规则。
请求:
响应:
{
"jsonrpc": "2.0",
"result": {
"itemids": [
"44211"
]
},
"id": 1
}
更新LLD规则脚本
使用不同的脚本更新 LLD 规则脚本,并删除之前脚本使用的不必要参数。
请求:
{
"jsonrpc": "2.0",
"method": "discoveryrule.update",
"params": {
"itemid": "23865",
"parameters": [],
"script": "Zabbix.Log(3, 'Log test');\nreturn 1;"
},
"auth": "700ca65537074ec963db7efabda78259",
响应: