integer/array discoveryrule.get(object parameters)
The method allows to retrieve LLD rules according to the given parameters.
(object) Parameters defining the desired output.
The method supports the following parameters.
| Parameter | Type | Description |
|---|---|---|
| itemids | string/array | Return only LLD rules with the given IDs. |
| hostids | string/array | Return only LLD rules that belong to the given hosts. |
| inherited | boolean | If set to true return only LLD rules inherited from a template. |
| interfaceids | string/array | Return only LLD rules use the given host interfaces. |
| monitored | boolean | If set to true return only enabled LLD rules that belong to monitored hosts. |
| templated | boolean | If set to true return only LLD rules that belong to templates. |
| templateids | string/array | Return only LLD rules that belong to the given templates. |
| selectHosts | query | Returns the host that the LLD rule belongs to as an array in the hosts property.Does not support shorten. |
| selectGraphs | query | Returns graph prototypes that belong to the LLD rule in the graphs property.Supports count; does not support shorten or arrays of properties. |
| selectItems | query | Returns item prototypes that belong to the LLD rule in the items property.Supports count; does not support shorten. |
| selectTriggers | query | Returns trigger prototypes that belong to the LLD rule in the triggers property.Supports count; does not support shorten or arrays of properties. |
| filter | object | Return only those results that exactly match the given filter. Accepts an array, where the keys are property names, and the values are either a single value or an array of values to match against. Supports additional filters: host - technical name of the host that the LLD rule belongs to. |
| limitSelects | integer | Limits the number of records returned by subselects. Applies to the following subselects: selctItems;selectGraphs;selectTriggers. |
| sortfield | string/array | Sort the result by the given properties. Possible values are: itemid, name, key_, delay, type and status. |
| countOutput | flag | These parameters being common for all get methods are described in detail on the Generic Zabbix API information page. |
| editable | boolean | |
| excludeSearch | flag | |
| limit | integer | |
| nodeids | string/array | |
| output | query | |
| preservekeys | flag | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | flag |
(integer/array) Returns either:
countOutput parameter has been used.Retrieve all discovery rules from host "10202".
Request:
{ "jsonrpc": "2.0", "method": "discoveryrule.get", "params": { "output": "extend", "hostids": "10202" }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }Response:
{ "jsonrpc": "2.0", "result": [ { "itemid": "27425", "type": "0", "snmp_community": "", "snmp_oid": "", "hostid": "10202", "name": "Network interface discovery", "key_": "net.if.discovery", "delay": "3600", "status": "0", "trapper_hosts": "", "snmpv3_securityname": "", "snmpv3_securitylevel": "0", "snmpv3_authpassphrase": "", "snmpv3_privpassphrase": "", "error": "", "templateid": "22444", "delay_flex": "", "params": "", "ipmi_sensor": "", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "filter": "{#IFNAME}:@Network interfaces for discovery", "interfaceid": "119", "port": "", "description": "Discovery of network interfaces as defined in global regular expression \"Network interfaces for discovery\".", "lifetime": "30" }, { "itemid": "27426", "type": "0", "snmp_community": "", "snmp_oid": "", "hostid": "10202", "name": "Mounted filesystem discovery", "key_": "vfs.fs.discovery", "delay": "3600", "status": "0", "trapper_hosts": "", "snmpv3_securityname": "", "snmpv3_securitylevel": "0", "snmpv3_authpassphrase": "", "snmpv3_privpassphrase": "", "error": "", "templateid": "22450", "delay_flex": "", "params": "", "ipmi_sensor": "", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "filter": "{#FSTYPE}:@File systems for discovery", "interfaceid": "119", "port": "", "description": "Discovery of file systems of different types as defined in global regular expression \"File systems for discovery\".", "lifetime": "30" } ], "id": 2 }CDiscoveryRule::get() in frontends/php/api/classes/CDiscoveryRule.php.