sla创建

Description

object sla.create(object/array SLAs)

This method allows to create new SLA objects.

This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object/array) SLA objects to create.

Additionally to the standard SLA properties, the method accepts the following parameters.

ParameterTypeDescription
service_tags
(required)
arraySLA service tags to be created for the SLA.
At least one service tag must be specified.
schedulearraySLA schedule to be created for the SLA.
Specifying an empty parameter will be interpreted as a 24x7 schedule.
Default: 24x7 schedule.
excluded_downtimesarraySLA excluded downtimes to be created for the SLA.

返回值

(object) 返回一个包含已创建 SLA 的 ID 的对象,在slaids属性下。返回的 ID 的顺序匹配通过的 SLA 的顺序。

示例

创建SLA

指示为以下对象创建 SLA 条目: * 跟踪 SQL 引擎相关服务的正常运行时间; * 除周六最后一小时外的所有工作日的自定义时间表; * 生效日期为 2022 年最后一天; * 从 7 月 4 日午夜开始,计划停机时间为 1 小时 15 分钟; * SLA 周报计算将开启; * 可接受的最低 SLO 为 99.9995%。

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "sla.create",
  4. "params": [
  5. {
  6. "name": "Database Uptime",
  7. "slo": "99.9995",
  8. "period": "1",
  9. "timezone": "America/Toronto",
  10. "description": "Provide excellent uptime for main database engines.",
  11. "effective_date": 1672444800,
  12. "status": 1,
  13. "schedule": [
  14. {
  15. "period_from": 0,
  16. "period_to": 601200
  17. }
  18. ],
  19. "service_tags": [
  20. {
  21. "tag": "Database",
  22. "operator": "0",
  23. "value": "MySQL"
  24. },
  25. {
  26. "tag": "Database",
  27. "operator": "0",
  28. "value": "PostgreSQL"
  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. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  41. "id": 1
  42. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "slaids": [
  5. "5"
  6. ]
  7. },
  8. "id": 1
  9. }

来源

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