integer/array service.get(object parameters)
The method allows to retrieve services according to the given parameters该方法允许根据给定的参数检索服务.
(object)
Parameters defining the desired output定义所需输出的参数.
The method supports the following parameters该方法支持以下参数.
Parameter参数 T | pe类型 Des | ription说明 |
---|---|---|
serviceids | string/array | Return only services with the given IDs只返回具有指定ID的服务. |
parentids | string/array | Return only services with the given hard-dependent parent services只返回服务与给定硬依赖的父级服务. |
childids | string/array | Return only services that are hard-dependent on the given child services仅返回对给定的子服务强依赖的服务. |
selectParent | query | Return the hard-dependent parent service in the parent property返回 'parent'' 属性中的强依赖父级服务. |
selectDependencies | query | Return child service dependencies in the dependencies property在dependencies 属性中返回子级服务依赖关系. |
selectParentDependencies | query | Return parent service dependencies in the parentDependencies property在parentDependencies 属性中返回父级服务依赖关系. |
selectTimes | query | Return service times in the times property在times 属性中返回服务时间. |
selectAlarms | query | Return service alarms in the alarms property在alarms 属性中返回服务报警. |
selectTrigger | query | Return the associated trigger in the trigger property返回trigger 属性中的关联触发器. |
sortfield | string/array | Sort the result by the given properties按给定的属性对结果分类. Possible values are可能的值为: name and和 sortorder . |
countOutput | flag | These parameters being common for all get methods are described in detail in the reference commentary.在reference commentary中详细描述了所有get 方法的这些参数。 |
editable | boolean | |
excludeSearch | flag | |
filter | object | |
limit | integer | |
output | query | |
preservekeys | flag | |
search | object | |
searchByAny | boolean | |
searchWildcardsEnabled | boolean | |
sortorder | string/array | |
startSearch | flag |
(integer/array)
Returns either返回两者其中任一:
countOutput
parameter has been used如果已经使用了countOutput
参数,则检索对象的计数.Retrieve all data about all services and their dependencies检索有关所有服务及其依赖关系的所有数据.
Request请求:
{
"jsonrpc": "2.0",
"method": "service.get",
"params": {
"output": "extend",
"selectDependencies": "extend"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response响应:
{
"jsonrpc": "2.0",
"result": [
{
"serviceid": "2",
"name": "Server 1",
"status": "0",
"algorithm": "1",
"triggerid": "0",
"showsla": "1",
"goodsla": "99.9000",
"sortorder": "0",
"dependencies": []
},
{
"serviceid": "3",
"name": "Data center 1",
"status": "0",
"algorithm": "1",
"triggerid": "0",
"showsla": "1",
"goodsla": "99.9000",
"sortorder": "0",
"dependencies": [
{
"linkid": "11",
"serviceupid": "3",
"servicedownid": "2",
"soft": "0",
"sortorder": "0",
"serviceid": "2"
},
{
"linkid": "10",
"serviceupid": "3",
"servicedownid": "5",
"soft": "0",
"sortorder": "1",
"serviceid": "5"
}
]
},
{
"serviceid": "5",
"name": "Server 2",
"status": "0",
"algorithm": "1",
"triggerid": "0",
"showsla": "1",
"goodsla": "99.9900",
"sortorder": "1",
"dependencies": []
}
],
"id": 1
}
CService::get() in frontends/php/include/classes/api/services/CService.php.