更新

    此方法更新已存在的LLD规则。

    此方法只有 Admin(管理员)Super admin(超级管理员) 用户可用。可以在用户角色设置中撤销调用该方法的权限。更多信息请查看。

    (object/array) 需要更新的 LLD 规则属性。

    必须为每个 LLD 规则定义“itemid”属性,所有其他属性都是可选的。只有传递的属性将被更新,所有其他的将保持不变。

    除了 ,该方法还接受以下参数。

    (object) 返回一个对象,其中包含 itemids 属性下更新的 LLD 规则的 ID。

    LLD 规则添加过滤器

    请求:

    响应:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": {
    4. "itemids": [
    5. "22450"
    6. ]
    7. },
    8. "id": 1
    9. }

    添加LLD宏路径

    请求:

    1. {
    2. "jsonrpc": "2.0",
    3. "method": "discoveryrule.update",
    4. "params": {
    5. "lld_macro_paths": [
    6. {
    7. "lld_macro": "{#MACRO1}",
    8. "path": "$.json.path"
    9. ]
    10. },
    11. "auth": "038e1d7b1735c6a5436ee9eae095879e",
    12. "id": 1
    13. }

    响应:

    禁止 trapping

    禁止自动发现规则trapping。

    请求:

    1. {
    2. "jsonrpc": "2.0",
    3. "method": "discoveryrule.update",
    4. "params": {
    5. "itemid": "28336",
    6. "allow_traps": "0"
    7. },
    8. "id": 36,
    9. "auth": "d678e0b85688ce578ff061bd29a20d3b"
    10. }
    1. {
    2. "jsonrpc": "2.0",
    3. "result": {
    4. "28336"
    5. ]
    6. "id": 36
    7. }

    更新LLD规则预处理选项

    使用预处理规则“JSONPath”更新LLD规则。

    请求:

    响应:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": {
    4. "itemids": [
    5. "44211"
    6. ]
    7. },
    8. "id": 1
    9. }

    更新LLD规则脚本

    使用不同的脚本更新 LLD 规则脚本,并删除之前脚本使用的不必要参数。

    请求:

    1. {
    2. "jsonrpc": "2.0",
    3. "method": "discoveryrule.update",
    4. "params": {
    5. "itemid": "23865",
    6. "parameters": [],
    7. "script": "Zabbix.Log(3, 'Log test');\nreturn 1;"
    8. },
    9. "auth": "700ca65537074ec963db7efabda78259",

    响应: