You are viewing documentation for the development version, it may be incomplete.
Join our translation project and help translate Zabbix documentation into your native language.

discoveryruleprototype.get

Description

integer/array discoveryruleprototype.get(object parameters)

The method allows to retrieve LLD rule prototypes according to the given parameters.

This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
itemids ID/array Return only LLD rule prototypes with the given IDs.
groupids ID/array Return only LLD rule prototypes that belong to the hosts from the given groups.
hostids ID/array Return only LLD rule prototypes that belong to the given hosts.
inherited boolean If set to true return only LLD rule prototypes inherited from a template.
interfaceids ID/array Return only LLD rule prototypes use the given host interfaces.
monitored boolean If set to true return only enabled LLD rule prototypes that belong to monitored hosts.
templated boolean If set to true return only LLD rule prototypes that belong to templates.
templateids ID/array Return only LLD rule prototypes that belong to the given templates.
selectDiscoveryRule query Return a discoveryRule property with the parent LLD rule of the LLD rule prototype.
selectDiscoveryRulePrototype query Return a discoveryRulePrototype property with the parent LLD rule prototype of the LLD rule prototype.
selectDiscoveryRulePrototypes query Return a discoveryRulePrototypes property with child LLD rule prototypes that belong to the LLD rule prototype.

Supports count.
selectFilter query Return a filter property with data of the filter used by the LLD rule prototype.
selectGraphs query Returns a graphs property with graph prototypes that belong to the LLD rule prototype.

Supports count.
selectHostPrototypes query Return a hostPrototypes property with host prototypes that belong to the LLD rule prototype.

Supports count.
selectHosts query Return a hosts property with an array of hosts that the LLD rule prototype belongs to.
selectItems query Return an items property with item prototypes that belong to the LLD rule prototype.

Supports count.
selectTriggers query Return a triggers property with trigger prototypes that belong to the LLD rule prototype.

Supports count.
selectLLDMacroPaths query Return an lld_macro_paths property with a list of LLD macros and paths to values assigned to each corresponding macro.
selectPreprocessing query Return a preprocessing property with LLD rule prototype preprocessing options.
selectOverrides query Return an lld_rule_overrides property with a list of override filters, conditions and operations that are performed on prototype objects.
filter object Return only those results that exactly match the given filter.

Accepts an object, where the keys are property names, and the values are either a single value or an array of values to match against.

Does not support properties of text data type.

Supports additional properties:
host - technical name of the host that the LLD rule prototype belongs to.
limitSelects integer Limits the number of records returned by subselects.

Applies to the following subselects: selectItems, selectGraphs, selectTriggers.
sortfield string/array Sort the result by the given properties.

Possible values: itemid, name, key_, delay, type, status.
countOutput boolean These parameters are described in the reference commentary.
editable boolean
excludeSearch boolean
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

Return values

(integer/array) Returns either:

  • an array of objects;
  • the count of retrieved objects, if the countOutput parameter has been used.

Examples

Retrieving discovery rule prototypes from a host

Retrieve all discovery rule prototypes for specific host ID.

Request:

{
           "jsonrpc": "2.0",
           "method": "discoveryruleprototype.get",
           "params": {
               "hostids": "10084"
           },
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "itemid": "47253",
                   "type": "23",
                   "snmp_oid": "",
                   "hostid": "10084",
                   "name": "Discover tablespaces for {#DB}",
                   "key_": "db.tablespace.discovery[{#DB}]",
                   "delay": "0",
                   "history": "31d",
                   "trends": "365d",
                   "status": "0",
                   "value_type": "4",
                   "trapper_hosts": "",
                   "units": "",
                   "logtimefmt": "",
                   "templateid": "0",
                   "valuemapid": "0",
                   "params": "",
                   "ipmi_sensor": "",
                   "authtype": "0",
                   "username": "",
                   "password": "",
                   "publickey": "",
                   "privatekey": "",
                   "flags": "3",
                   "interfaceid": "0",
                   "description": "",
                   "inventory_link": "0",
                   "lifetime": "7d",
                   "jmx_endpoint": "",
                   "master_itemid": "0",
                   "timeout": "",
                   "url": "",
                   "query_fields": [],
                   "posts": "",
                   "status_codes": "200",
                   "follow_redirects": "1",
                   "post_type": "0",
                   "http_proxy": "",
                   "headers": [],
                   "retrieve_mode": "0",
                   "request_method": "0",
                   "ssl_cert_file": "",
                   "ssl_key_file": "",
                   "ssl_key_password": "",
                   "verify_peer": "0",
                   "verify_host": "0",
                   "allow_traps": "0",
                   "discover": "0",
                   "uuid": "",
                   "lifetime_type": "0",
                   "enabled_lifetime_type": "2",
                   "enabled_lifetime": "0",
                   "parameters": []
               }
           ],
           "id": 1
       }

See also

Source

CDiscoveryRulePrototype::get() in ui/include/classes/api/services/CDiscoveryRulePrototype.php.