This is a translation of the original English documentation page. Help us make it better.

hostinterface.get

Leírás

integer/array hostinterface.get(object parameters)

A metódus lehetővé teszi a host interfészek lekérését a megadottak szerint paramétereket.

Ez a módszer bármilyen típusú felhasználó számára elérhető. Engedélyek A metódus meghívása a felhasználói szerepkör beállításaiban visszavonható. Lásd: User roles további információért.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
hostids string/array Return only host interfaces used by the given hosts.
interfaceids string/array Return only host interfaces with the given IDs.
itemids string/array Return only host interfaces used by the given items.
triggerids string/array Return only host interfaces used by items in the given triggers.
selectItems query Return an items property with the items that use the interface.

Supports count.
selectHosts query Return a hosts property with an array of hosts that use the interface.
limitSelects integer Limits the number of records returned by subselects.

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

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

Visszatérési értékek

(integer/array) 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 host interfaces

Retrieve all data about the interfaces used by host "30057."

Request:

{
           "jsonrpc": "2.0",
           "method": "hostinterface.get",
           "params": {
               "output": "extend",
               "hostids": "30057"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "interfaceid": "50039",
                   "hostid": "30057",
                   "main": "1",
                   "type": "1",
                   "useip": "1",
                   "ip": "::1",
                   "dns": "",
                   "port": "10050",
                   "available": "0",
                   "error": "",
                   "errors_from": "0",
                   "disable_until": "0",
                   "details": []
               },
               {
                   "interfaceid": "55082",
                   "hostid": "30057",
                   "main": "0",
                   "type": "1",
                   "useip": "1",
                   "ip": "127.0.0.1",
                   "dns": "",
                   "port": "10051",
                   "available": "0",
                   "error": "",
                   "errors_from": "0",
                   "disable_until": "0",
                   "details": {
                       "version": "2",
                       "bulk": "0",
                       "community": "{$SNMP_COMMUNITY}"
                   }
               }
           ],
           "id": 1
       }

Lásd még

Forrás

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