Sidebar

api:drule:get

Table of Contents

get()

Available since version: 1.8
This function allows you to retrieve discovery rule details based on filtering options. All parameters are optional. If parameter is set in query this option counted as ON, except if parameter is equal to NULL.

Parameters

ParameterTypeDescriptionDetails
nodeidsarrayNode IDs
druleidsarrayDiscovery rule IDs
dhostidsarrayDiscovery host IDs
dserviceidsarrayDiscovery service IDs
dcheckidsarrayDiscovery check IDs
editableintegeronly with read-write permission. Ignored for SuperAdmins
filterarrayOptional filter by discovery rule fields
searcharrayReturn discovery rules by any given discovery rule object field pattern
startSearchintegerSearch discovery rules field pattern only in start of the field
excludeSearchintegerExclude from result, discovery rules by given field pattern
searchWildcardsEnabledintegerSearch pattern in whole field using wildcards 1 - enable, 0 - disable
outputstringOutput options Values: shorten, refer, extend
selectDHostsstringSelect discovery hosts Values: shorten, refer, extend
selectDChecksstringSelect discovery checks Values: shorten, refer, extend
selectDServicesstringSelect discovery services Values: shorten, refer, extend
countOutputintegerCount discovery rules, return the number of discovery rules found
groupCountintegerReturn the number of results grouped by given IDs
preservekeysintegerReturn hash instead of array Keys of hash are object IDs
sortfieldstringSort by discovery rule field Values: druleid, name
sortorderstringSort order Values: ASC, DESC
limitintmax number of discovery rule objects to return

Returns

ParameterDescription
resultOperation successful. Result will contain array of Discovery rule objects.
errorIn case of any errors

Example

Get discovery rules details by discovery rule name pattern “local”:

{
"jsonrpc":"2.0",
"method":"drule.get",
"params":{
	"search": {"name": "local"},
	"output": "extend"
},
"auth":"6f38cddc44cfbb6c1bd186f9a220b5a0",
"id":2
}
Retrieved discovery rule details:

{
"jsonrpc":"2.0",
"result":[{
	"druleid":"100100000000003",
	"proxy_hostid":"0",
	"name":"Local network",
	"iprange":"192.168.0.1-255",
	"delay":"3600",
	"nextcheck":"1280502905",
	"status":"0",
	"unique_dcheckid":"0"
}],
"id":2
}