dhost.get

Leírás

integer/array dhost.get(object parameters)

A módszer lehetővé teszi a felfedezett gazdaszervezetek visszakeresését az adott paramétereket.

Ez a módszer bármilyen típusú felhasználók számára elérhető. Engedélyek A módszer felhívása visszavonható a felhasználói szerepbeállításokban. Lásd: [Felhasználó Szerepek] (/kézikönyv/web_interface/frontend_sections/adminisztráció/user_roles) további információért.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
dhostids string/array Return only discovered hosts with the given IDs.
druleids string/array Return only discovered hosts that have been created by the given discovery rules.
dserviceids string/array Return only discovered hosts that are running the given services.
selectDRules query Return a drules property with an array of the discovery rules that detected the host.
selectDServices query Return a dservices property with the discovered services running on the host.

Supports count.
limitSelects integer Limits the number of records returned by subselects.

Applies to the following subselects:
selectDServices - results will be sorted by dserviceid.
sortfield string/array Sort the result by the given properties.

Possible values are: dhostid and druleid.
countOutput boolean These parameters being common for all get methods are described in detail in the reference commentary.
editable boolean
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

Visszatérési értékek

(egész szám/tömb) A következőket adja vissza:

  • objektumok tömbje;
  • a letöltött objektumok száma, ha a countOutput paraméter rendelkezik használtak.

Példák

Retrieve discovered hosts by discovery rule

Retrieve all hosts and the discovered services they are running that have been detected by discovery rule "4".

Request:

{
           "jsonrpc": "2.0",
           "method": "dhost.get",
           "params": {
               "output": "extend",
               "selectDServices": "extend",
               "druleids": "4"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "dservices": [
                       {
                           "dserviceid": "1",
                           "dhostid": "1",
                           "type": "4",
                           "key_": "",
                           "value": "",
                           "port": "80",
                           "status": "0",
                           "lastup": "1337697227",
                           "lastdown": "0",
                           "dcheckid": "5",
                           "ip": "192.168.1.1",
                           "dns": "station.company.lan"
                       }
                   ],
                   "dhostid": "1",
                   "druleid": "4",
                   "status": "0",
                   "lastup": "1337697227",
                   "lastdown": "0"
               },
               {
                   "dservices": [
                       {
                           "dserviceid": "2",
                           "dhostid": "2",
                           "type": "4",
                           "key_": "",
                           "value": "",
                           "port": "80",
                           "status": "0",
                           "lastup": "1337697234",
                           "lastdown": "0",
                           "dcheckid": "5",
                           "ip": "192.168.1.4",
                           "dns": "john.company.lan"
                       }
                   ],
                   "dhostid": "2",
                   "druleid": "4",
                   "status": "0",
                   "lastup": "1337697234",
                   "lastdown": "0"
               },
               {
                   "dservices": [
                       {
                           "dserviceid": "3",
                           "dhostid": "3",
                           "type": "4",
                           "key_": "",
                           "value": "",
                           "port": "80",
                           "status": "0",
                           "lastup": "1337697234",
                           "lastdown": "0",
                           "dcheckid": "5",
                           "ip": "192.168.1.26",
                           "dns": "printer.company.lan"
                       }
                   ],
                   "dhostid": "3",
                   "druleid": "4",
                   "status": "0",
                   "lastup": "1337697234",
                   "lastdown": "0"
               },
               {
                   "dservices": [
                       {
                           "dserviceid": "4",
                           "dhostid": "4",
                           "type": "4",
                           "key_": "",
                           "value": "",
                           "port": "80",
                           "status": "0",
                           "lastup": "1337697234",
                           "lastdown": "0",
                           "dcheckid": "5",
                           "ip": "192.168.1.7",
                           "dns": "mail.company.lan"
                       }
                   ],
                   "dhostid": "4",
                   "druleid": "4",
                   "status": "0",
                   "lastup": "1337697234",
                   "lastdown": "0"
               }
           ],
           "id": 1
       }

Lásd még

  • [Felfedezve Szolgáltatás] (/kézikönyv/API/referencia/dservice/objektum#disconded_service)
  • [Discovery szabály] (/kézikönyv/API/Reference/Drule/Object#Discovery_rule)

Forrás

CDHOST :: get () a ui/incles/classs/api/services/cdhost.php .