sla.get

描述

integer/array sla.get(object parameters)

该方法允许根据给定的参数检索 SLA 对象。

此方法适用于任何类型的用户。权限 调用方法可以在用户角色设置中撤销。请参阅 用户 角色 了解更多信息。

参数

(object) 定义所需输出的参数。

该方法支持以下参数。

参数类型描述
slaids字符串/数组仅返回具有给定 ID 的 SLA。
serviceids字符串/数组仅返回与特定服务匹配的 SLA。
selectSchedule查询返回带有 SLA 计划的“计划”属性。

支持“计数”。
selectExcludedDowntimes查询回 SLA 排除停机时间的“excluded_downtimes”属性。

支持“计数”。
selectServiceTags查询返回带有 SLA 服务标签的 service_tags 属性。

支持 count
sortfield字符串/数组按给定属性对结果进行排序。

可能的值有:slaidnameperiodsloeffective_datetimezonestatusdescription
countOutput布尔类型参考评论 中详细描述了所有 get 方法通用的这些参数。
editable布尔类型
excludeSearch布尔类型
filter对象
limit整型
output查询
preservekeys布尔类型
search对象
searchByAny布尔类型
searchWildcardsEnabled布尔类型
sortorder字符串/数组
startSearch布尔类型

返回值

(integer/array) 返回以下任一选项

  • 对象数组;
  • 如果使用countOutput参数,被检索对象的数量。

示例

检索所有SLAs

检索有关所有 SLA 及其属性的所有数据。

请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "sla.get",
  4. "params": {
  5. "output": "extend",
  6. "selectSchedule": ["period_from", "period_to"],
  7. "selectExcludedDowntimes": ["name", "period_from", "period_to"],
  8. "selectServiceTags": ["tag", "operator", "value"],
  9. "preservekeys": true
  10. },
  11. "auth": "85dd04b94cbfad794616eb923be13c71",
  12. "id": 1
  13. }

响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "1": {
  5. "slaid": "1",
  6. "name": "Database Uptime",
  7. "period": "1",
  8. "slo": "99.9995",
  9. "effective_date": "1672444800",
  10. "timezone": "America/Toronto",
  11. "status": "1",
  12. "description": "Provide excellent uptime for main SQL database engines.",
  13. "service_tags": [
  14. {
  15. "tag": "Database",
  16. "operator": "0",
  17. "value": "MySQL"
  18. },
  19. {
  20. "tag": "Database",
  21. "operator": "0",
  22. "value": "PostgreSQL"
  23. }
  24. ],
  25. "schedule": [
  26. {
  27. "period_from": "0",
  28. "period_to": "601200"
  29. }
  30. ],
  31. "excluded_downtimes": [
  32. {
  33. "name": "Software version upgrade rollout",
  34. "period_from": "1648760400",
  35. "period_to": "1648764900"
  36. }
  37. ]
  38. }
  39. },
  40. "id": 1
  41. }

来源

CSla:get() in ui/include/classes/api/services/CSla.php.