Zabbix Documentation 1.8

Sidebar

Table of Contents

get()

Available since version: 1.8
This function allows you to retrieve discovery service 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

Parameter Type Description Details
nodeids array Node IDs
druleids array Discovery rule IDs
dhostids array Discovery host IDs
dcheckids array Discovery check IDs
dserviceids array Discovery service IDs
editable integer only with read-write permission. Ignored for SuperAdmins
filter array Optional filter by discovery service fields
search array Return discovery services by any given discovery service object field pattern
startSearch integer Search discovery services field pattern only in start of the field
excludeSearch integer Exclude from result, discovery services by given field pattern
searchWildcardsEnabled integer Search pattern in whole field using wildcards 1 - enable, 0 - disable
output string Output options Values: shorten, refer, extend
selectDRules string Select discovery rules Values: shorten, refer, extend
selectDChecks string Select discovery checks Values: shorten, refer, extend
selectDHosts string Select discovered hosts Values: shorten, refer, extend
selectHosts string Select hosts Values: shorten, refer, extend
countOutput integer Count discovery hosts, return the number of discovery services found
groupCount integer Return the number of results grouped by given IDs
preservekeys integer Return hash instead of array Keys of hash are object IDs
sortfield string Sort by discovery service field Values: dserviceid, dhostid
sortorder string Sort order Values: ASC, DESC
limit int max number of discovery service objects to return

Returns

Parameter Description
result Operation successful. Result will contain array of Discovery service objects.
error In case of any errors

Example

Get discovery services details by discovery rule ID:

{
       "jsonrpc":"2.0",
       "method":"dservice.get",
       "params":{
           "druleids": ["100100000000003"],
           "output": "extend",
           "limit": 2
       },
       "auth":"6f38cddc44cfbb6c1bd186f9a220b5a0",
       "id":2
       }

Retrieved discovery services details:

{
       "jsonrpc":"2.0",
       "result":[{
           "drules":[{
               "druleid":"100100000000003"
           }],
           "dhosts":[{
               "dhostid":"100100000000036"
           }],
           "dchecks":[{
               "dcheckid":"100100000000037"
           }],
           "dserviceid":"100100000000042",
           "dhostid":"100100000000036",
           "type":"4",
           "key_":"",
           "value":"",
           "port":"80",
           "status":"0",
           "lastup":"1252320879",
           "lastdown":"0",
           "dcheckid":"100100000000037",
           "ip":"192.168.3.1",
           "druleid":"100100000000003"
       },{
           "drules":[{
               "druleid":"100100000000003"
           }],
           "dhosts":[{
               "dhostid":"100100000000037"
           }],
           "dchecks":[{
               "dcheckid":"100100000000037"
           }],
           "dserviceid":"100100000000043",
           "dhostid":"100100000000037",
           "type":"4",
           "key_":"",
           "value":"",
           "port":"80",
           "status":"1",
           "lastup":"0",
           "lastdown":"1271859008",
           "dcheckid":"100100000000037",
           "ip":"192.168.3.2",
           "druleid":"100100000000003"
       }],
       "id":2
       }