sla.getsli

    此方法允许计算服务水平指标 (SLI) 数据。

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

    时段划分

    下面演示基于参数组合的返回周期切片的排列。

    (object) 返回计算的结果

    SLI 数据

    计算SLI

    从 2021 年 11 月 1 日开始,在 ID 为“50、60 和 70”的服务上检索与 ID 为“5”的 SLA 相关联的 SLI,为期 3 个时段。

    请求:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": {
    4. "periods": [
    5. {
    6. "period_from": 1635724800,
    7. "period_to": 1638316800
    8. },
    9. {
    10. "period_from": 1638316800,
    11. "period_to": 1640995200
    12. },
    13. {
    14. "period_from": 1640995200,
    15. "period_to": 1643673600
    16. }
    17. ],
    18. "serviceids": [
    19. 50,
    20. 60,
    21. 70
    22. ],
    23. "sli": [
    24. [
    25. {
    26. "uptime": 1186212,
    27. "downtime": 0,
    28. "sli": 100,
    29. "error_budget": 0,
    30. "excluded_downtimes": [
    31. {
    32. "name": "Excluded Downtime - 1",
    33. "period_from": 1637836212,
    34. "period_to": 1638316800
    35. }
    36. ]
    37. },
    38. "downtime": 0,
    39. "sli": 100,
    40. "error_budget": 0,
    41. "excluded_downtimes": [
    42. {
    43. "name": "Excluded Downtime - 1",
    44. "period_from": 1637836212,
    45. "period_to": 1638316800
    46. }
    47. ]
    48. },
    49. {
    50. "uptime": 1186212,
    51. "downtime": 0,
    52. "sli": 100,
    53. "error_budget": 0,
    54. "excluded_downtimes": [
    55. {
    56. "name": "Excluded Downtime - 1",
    57. "period_from": 1637836212,
    58. "period_to": 1638316800
    59. }
    60. ]
    61. }
    62. ],
    63. [
    64. {
    65. "uptime": 1147548,
    66. "downtime": 0,
    67. "sli": 100,
    68. "error_budget": 0,
    69. "excluded_downtimes": [
    70. {
    71. "name": "Excluded Downtime - 1",
    72. "period_from": 1638439200,
    73. "period_to": 1639109652
    74. }
    75. ]
    76. },
    77. {
    78. "uptime": 1147548,
    79. "downtime": 0,
    80. "sli": 100,
    81. "error_budget": 0,
    82. "excluded_downtimes": [
    83. "period_from": 1638439200,
    84. "period_to": 1639109652
    85. }
    86. ]
    87. },
    88. {
    89. "uptime": 1147548,
    90. "downtime": 0,
    91. "sli": 100,
    92. "error_budget": 0,
    93. "excluded_downtimes": [
    94. {
    95. "name": "Excluded Downtime - 1",
    96. "period_from": 1638439200,
    97. "period_to": 1639109652
    98. }
    99. ]
    100. }
    101. ],
    102. [
    103. {
    104. "uptime": 1674000,
    105. "downtime": 0,
    106. "sli": 100,
    107. "error_budget": 0,
    108. "excluded_downtimes": []
    109. },
    110. {
    111. "uptime": 1674000,
    112. "downtime": 0,
    113. "sli": 100,
    114. "error_budget": 0,
    115. "excluded_downtimes": []
    116. },
    117. {
    118. "uptime": 1674000,
    119. "downtime": 0,
    120. "sli": 100,
    121. "error_budget": 0,
    122. "excluded_downtimes": []
    123. }
    124. ]
    125. ]
    126. },
    127. "id": 1

    CService::getSla() in ui/include/classes/api/services/CService.php.