获取
描述
integer/array dservice.get(object parameters)
这个方法允许根据给定的参数检索发现的服务。
参数
(object)
定义需要输出的参数。
这个方法支持以下参数。
返回值
(integer/array)
返回:
- 一个对象数组;
- 如果使用了
countOutput
参数,被检索的对象的数量。
示例
检索在主机上发现的服务
检索在被发现主机 “11” 上发现的所有被发现的服务。
请求:
{
"jsonrpc": "2.0",
"method": "dservice.get",
"params": {
"output": "extend",
"dhostids": "11"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
响应:
{
"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 frontends/php/include/classes/api/services/CDService.php.