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

dservice.get

説明

integer/array dservice.get(object parameters)

このメソッドは、指定されたパラメータに従って、検出されたサービスを取得することができます。

このメソッドは、どのタイプのユーザーでも利用可能です。このメソッドを呼び出す許可は、ユーザーロール設定で
取り消すことができます。詳しくは User roles をご覧ください。

パラメータ

(object) 希望する出力を定義するパラメータ

このメソッドは、以下のパラメータをサポートしています。

パラメータ Type 説明
dserviceids string/array Return only discovered services with the given IDs.
dhostids string/array Return only discovered services that belong to the given discovered hosts.
dcheckids string/array Return only discovered services that have been detected by the given discovery checks.
druleids string/array Return only discovered services that have been detected by the given discovery rules.
selectDRules query Return a drules property with an array of the discovery rules that detected the service.
selectDHosts query Return a dhosts property with an array the discovered hosts that the service belongs to.
selectHosts query Return a hosts property with the hosts with the same IP address and proxy as the service.

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

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

Possible values are: dserviceid, dhostid and ip.
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

戻り値

(integer/array) 次のいずれかを返します:

  • オブジェクトの配列
  • countOutputパラメーターが使用されている場合、取得したオブジェクトの数

ホスト上で検出されたサービスを取得する

発見されたホスト "11" 上で検出されたすべてのサービスを取得します。

Request:

{
           "jsonrpc": "2.0",
           "method": "dservice.get",
           "params": {
               "output": "extend",
               "dhostids": "11"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "dserviceid": "12",
                   "dhostid": "11",
                   "value": "",
                   "port": "80",
                   "status": "1",
                   "lastup": "0",
                   "lastdown": "1348650607",
                   "dcheckid": "5",
                   "ip": "192.168.1.134",
                   "dns": "john.local"
               },
               {
                   "dserviceid": "13",
                   "dhostid": "11",
                   "value": "",
                   "port": "21",
                   "status": "1",
                   "lastup": "0",
                   "lastdown": "1348650610",
                   "dcheckid": "6",
                   "ip": "192.168.1.134",
                   "dns": "john.local"
               }
           ],
           "id": 1
       }

参照

ソース

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