integer/array service.get(object parameters)
このメソッドで、指定されたパラメーターに従ってサービスを取得できます。
このメソッドはどのタイプのユーザーでも利用可能です。このメソッドを呼び出す権限は、ユーザーロール設定で取り消すことができます。詳しくはユーザーの役割を参照してください。
(object) Parameters defining the desired output.
The method supports the following parameters.
| Parameter | Type | Description |
|---|---|---|
| serviceids | string/array | Return only services with the given IDs. |
| parentids | string/array | Return only services that are linked to the given parent services. |
| deep_parentids | flag | Return all direct and indirect child services. Used together with parentids. |
| childids | string/array | Return only services that are linked to the given child services. |
| evaltype | integer | Rules for tag searching. Possible values: 0 - (default) And/Or; 2 - Or. |
| tags | object/array of objects | Return only services with given tags. Exact match by tag and case-sensitive or case-insensitive search by tag value depending on operator value. Format: [{"tag": "<tag>", "value": "<value>", "operator": "<operator>"}, ...].An empty array returns all services. Possible operator values: 0 - (default) Contains; 1 - Equals; 2 - Does not contain; 3 - Does not equal; 4 - Exists; 5 - Does not exist. |
| problem_tags | object/array of objects | Return only services with given problem tags. Exact match by tag and case-sensitive or case-insensitive search by tag value depending on operator value. Format: [{"tag": "<tag>", "value": "<value>", "operator": "<operator>"}, ...].An empty array returns all services. Possible operator values: 0 - (default) Contains; 1 - Equals; 2 - Does not contain; 3 - Does not equal; 4 - Exists; 5 - Does not exist. |
| without_problem_tags | flag | Return only services without problem tags. |
| selectAlarms | query | Return an alarms property with service alarms. Supports count. |
| selectChildren | query | Return a children property with the child services.Supports count. |
| selectParents | query | Return a parents property with the parent services.Supports count. |
| selectTags | query | Return a tags property with service tags. Supports count. |
| selectTimes | query | Return a times property with service times. Supports count. |
| selectProblemEvents | query | Return a problem_events property with an array of problem event objects.The problem event object has the following properties: eventid - (string) Event ID;severity - (string) Current event severity;name - (string) Resolved event name.Supports count. |
| selectProblemTags | query | Return a problem_tags property with problem tags. Supports count. |
| selectStatusRules | query | Return a status_rules property with status rules. Supports count. |
| sortfield | string/array | Sort the result by the given properties. Possible values are: name and sortorder. |
| 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パラメータが使用されている場合、取得されたオブジェクトの数Retrieve all data about all services and their dependencies.
Request:
{
"jsonrpc": "2.0",
"method": "service.get",
"params": {
"output": "extend",
"selectChildren": "extend",
"selectParents": "extend"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}Response:
{
"jsonrpc": "2.0",
"result": [
{
"serviceid": "1",
"name": "Data centers",
"status": "0",
"algorithm": "1",
"showsla": "0",
"goodsla": "99.9",
"sortorder": "0",
"parents": [],
"children": [
{
"serviceid": "2",
"name": "Server 1",
"status": "0",
"algorithm": "1",
"showsla": "0",
"goodsla": "99.9",
"sortorder": "0"
},
{
"serviceid": "3",
"name": "Server 2",
"status": "0",
"algorithm": "1",
"showsla": "0",
"goodsla": "99.9",
"sortorder": "0"
}
]
},
{
"serviceid": "2",
"name": "Server 1",
"status": "0",
"algorithm": "1",
"showsla": "0",
"goodsla": "99.9",
"sortorder": "0",
"parents": [
{
"serviceid": "1",
"name": "Data centers",
"status": "0",
"algorithm": "1",
"showsla": "0",
"goodsla": "99.9",
"sortorder": "0"
}
],
"children": []
},
{
"serviceid": "3",
"name": "Server 2",
"status": "0",
"algorithm": "1",
"showsla": "0",
"goodsla": "99.9",
"sortorder": "0",
"parents": [
{
"serviceid": "1",
"name": "Data centers",
"status": "0",
"algorithm": "1",
"showsla": "0",
"goodsla": "99.9",
"sortorder": "0"
}
],
"children": []
}
],
"id": 1
}CService::get() in ui/include/classes/api/services/CService.php.