Zabbix Documentation 5.0

3.04.05.0 (current)| In development:5.2 (devel)| Unsupported:1.82.02.22.43.23.44.24.4Guidelines

User Tools

Site Tools


manual:api:reference:discoveryrule:update

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
manual:api:reference:discoveryrule:update [2014/09/26 11:21]
sasha Links adapted because of a move operation
manual:api:reference:discoveryrule:update [2020/05/05 11:37]
martins-v frontends/php -> ui (ZBX-17667)
Line 16: Line 16:
  
 ^ Parameter ^ Type ^ Description ^ ^ Parameter ^ Type ^ Description ^
-| filter | object | LLD rule filter object to replace the current filter. |+| filter | object | LLD rule [[:​manual/​api/​reference/​discoveryrule/​object#​lld_rule_filter|filter]] object to replace the current filter. | 
 +| preprocessing | array | LLD rule [[:​manual/​api/​reference/​discoveryrule/​object#​lld_rule_preprocessing|preprocessing]] options to replace the current preprocessing options. |
  
 ==== Return values ==== ==== Return values ====
Line 23: Line 24:
  
 ==== Examples ==== ==== Examples ====
- 
 === Adding a filter to an LLD rule === === 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. Add a filter so that the contents of the //​{#​FSTYPE}//​ macro would match the //@File systems for discovery// regexp.
  
 Request: Request:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
     "​method":​ "​discoveryrule.update",​     "​method":​ "​discoveryrule.update",​
     "​params":​ {     "​params":​ {
-        "​itemid":​ "24682",+        "​itemid":​ "22450",
         "​filter":​ {         "​filter":​ {
             "​evaltype":​ 1,             "​evaltype":​ 1,
Line 51: Line 50:
  
 Response: Response:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 57: Line 56:
         "​itemids":​ [         "​itemids":​ [
             "​22450"​             "​22450"​
 +        ]
 +    },
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +=== Adding LLD macro paths ===
 +
 +Request:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​method":​ "​discoveryrule.update",​
 +    "​params":​ {
 +        "​itemid":​ "​22450",​
 +        "​lld_macro_paths":​ [
 +            {
 +                "​lld_macro":​ "​{#​MACRO1}",​
 +                "​path":​ "​$.json.path"​
 +            }
 +        ]
 +    },
 +    "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +Response:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​result":​ {
 +        "​itemids":​ [
 +            "​22450"​
 +        ]
 +    },
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +=== Disable trapping ===
 +
 +Disable LLD trapping for discovery rule.
 +
 +Request:
 +
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​method":​ "​discoveryrule.update",​
 +    "​params":​ {
 +        "​itemid":​ "​28336",​
 +        "​allow_traps":​ "​0"​
 +    },
 +    "​id":​ 36,
 +    "​auth":​ "​d678e0b85688ce578ff061bd29a20d3b"​
 +}
 +</​code>​
 +
 +Response:
 +
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​result":​ {
 +        "​itemids":​ [
 +            "​28336"​
 +        ]
 +    },
 +    "​id":​ 36
 +}
 +</​code>​
 +
 +=== Updating LLD rule preprocessing options ===
 +
 +Update an LLD rule with preprocessing rule “JSONPath”.
 +
 +Request:
 +<code java>
 +{
 +    "​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
 +}
 +</​code>​
 +
 +Response:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​result":​ {
 +        "​itemids":​ [
 +            "​44211"​
         ]         ]
     },     },
Line 65: Line 169:
 ==== Source ==== ==== Source ====
  
-CDiscoveryRule::​update() in //frontends/php/api/classes/​CDiscoveryRule.php//​.+CDiscoveryRule::​update() in //ui/include/​classes/api/services/​CDiscoveryRule.php//​.