object service.getsla(object parameters)
This method allows to calculate availability information about services该方法允许计算有关服务的可用性信息.
(object)
Parameters containing the IDs of the services and time intervals to calculate SLA包含服务ID和计算SLA的时间间隔的参数.
Parameter参数 T | pe类型 Des | ription说明 |
---|---|---|
serviceids | string/array | IDs of services to return availability information for提供可用性信息的服务ID. |
intervals | array | Time intervals to return service layer availability information about返回服务层可用性信息的时间间隔. Each time interval must have the following parameters每个时间间隔必须具有以下参数: - from - (timestamp) interval start time间隔开始时间;- to - (timestamp) interval end time间隔结束时间. |
(object)
Returns the following availability information about each service under the corresponding service ID返回相应服务ID下的每个服务下可用性信息.
Property参数 T | pe类型 Des | ription说明 |
---|---|---|
status | integer | Current status of the service服务的当前状态. Refer to the service object page for more information on service statuses.有关服务状态的更多信息,请参阅service object page |
problems | array | Triggers that are currently in problem state and are linked either to the service or one of its descendants目前处于问题状态并与服务或其后相关联的触发器. |
sla | array | SLA data about each time period每个时间段的SLA数据. Each SLA object has the following properties每个SLA对象具有以下属性: - from - (timestamp) interval start time间隔开始时间;- to - (timestamp) interval end time间隔结束时间;- sla - (float) SLA for the given time intervalSLA在给定的时间间隔;- okTime - (integer) time the service was in OK state, in seconds;时间服务处于OK状态,单位秒;- problemTime - (integer) time the service was in problem state, in seconds;时间服务处于问题状态,单位秒;- downtimeTime - (integer) time the service was in scheduled downtime, in seconds.在预定宕机时间的服务时间,单位秒 |
Retrieve availability information about a service during a week在一周内检索有关服务的可用性信息。.
Request请求:
{
"jsonrpc": "2.0",
"method": "service.getsla",
"params": {
"serviceids": "2",
"intervals": [
{
"from": 1352452201,
"to": 1353057001
}
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response响应:
{
"jsonrpc": "2.0",
"result": {
"2": {
"status": "3",
"problems": {
"13904": {
"triggerid": "13904",
"expression": "{13359}=0",
"description": "Service unavailable",
"url": "",
"status": "0",
"value": "1",
"priority": "3",
"lastchange": "1352967420",
"comments": "",
"error": "",
"templateid": "0",
"type": "0",
"value_flags": "0",
"flags": "0"
}
},
"sla": [
{
"from": 1352452201,
"to": 1353057001,
"sla": 97.046296296296,
"okTime": 586936,
"problemTime": 17864,
"downtimeTime": 0
}
]
}
},
"id": 1
}
CService::getSla() in frontends/php/include/classes/api/services/CService.php.