integer/array sla.get(object parameters)
该方法允许根据给定参数检索SLA objects。
此方法适用于任何类型的用户。调用该方法的权限可以在用户角色设置中撤销。更多信息请参阅User roles。
(object)
定义所需输出的参数。
该方法支持以下参数。
参数 | 数据类型 | 描述 |
---|---|---|
slaids | string/array | 仅返回具有给定ID的SLAs。 |
serviceids | string/array | 仅返回匹配特定服务的SLAs。 |
selectSchedule | query | 返回一个包含SLA时间表的schedule 属性。支持 count 。 |
selectExcludedDowntimes | query | 返回一个包含SLA排除停机时间的excluded_downtimes 属性。支持 count 。 |
selectServiceTags | query | 返回一个包含SLA服务标签的service_tags 属性。支持 count 。 |
sortfield | string/array | 按给定属性对结果进行排序。 可能的值为: slaid , name , period , slo , effective_date , timezone , status 和description 。 |
countOutput | boolean | 这些参数在通用get方法参数中有描述。 |
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
参数时)获取所有SLA及其属性的完整数据。
请求:
{
"jsonrpc": "2.0",
"method": "sla.get",
"params": {
"output": "extend",
"selectSchedule": ["period_from", "period_to"],
"selectExcludedDowntimes": ["name", "period_from", "period_to"],
"selectServiceTags": ["tag", "operator", "value"],
"preservekeys": true
},
"auth": "85dd04b94cbfad794616eb923be13c71",
"id": 1
}
响应:
{
"jsonrpc": "2.0",
"result": {
"1": {
"slaid": "1",
"name": "Database Uptime",
"period": "1",
"slo": "99.9995",
"effective_date": "1672444800",
"timezone": "America/Toronto",
"status": "1",
"description": "Provide excellent uptime for main SQL database engines.",
"service_tags": [
{
"tag": "Database",
"operator": "0",
"value": "MySQL"
},
{
"tag": "Database",
"operator": "0",
"value": "PostgreSQL"
}
],
"schedule": [
{
"period_from": "0",
"period_to": "601200"
}
],
"excluded_downtimes": [
{
"name": "Software version upgrade rollout",
"period_from": "1648760400",
"period_to": "1648764900"
}
]
}
},
"id": 1
}
CSla:get() 位于 ui/include/classes/api/services/CSla.php 文件中。