object sla.getsli(object parameters)
This method allows to calculate the Service Level Indicator (SLI) data.
This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.
(object)
Parameters containing the SLA ID, reporting periods and, optionally, the IDs of the services - to calculate the SLI for.
Parameter | Type | Description |
---|---|---|
slaid (required) |
string | IDs of services to return availability information for. |
period_from | integer | Starting date (inclusive) to report the SLI for. Possible values: timestamp. |
period_to | integer | Ending date (exclusive) to report the SLI for. Possible values: timestamp. |
periods | array | Preferred number of periods to report. Possible values: 1-100 |
serviceids | string/array | IDs of services to return the SLI for. |
The following demonstrates the arrangement of returned period slices based on combinations of parameters.
Parameters | Description | ||
---|---|---|---|
period_from | period_to | periods | |
- | - | - | The last 20 periods (including the current one) but not past the first available period based on the effective date of the SLA. |
- | - | specified | The last periods specified by the periods parameter. |
- | specified | - | The last 20 periods before the specified date, but not past the first available period based on the effective date of the SLA. |
- | specified | specified | The last periods specified by the periods parameter before the specified date. |
specified | - | - | The first 20 periods (including the current one) but not past the current one. |
specified | - | specified | The first periods specified by the periods parameter starting with the specified date. |
specified | specified | - | Periods within the specified date range, but no more than 100 and not past the first available period based on the effective date of the SLA. |
specified | specified | specified | Periods within the specified date range, but no more than the specified number of periods and not past the first available period based on the effective date of the SLA. |
(object)
Returns the results of the calculation.
Property | Type | Description |
---|---|---|
periods | array | List of the reported periods. Each reported period is represented as an object consisting of: - period_from - Starting date of the reported period (timestamp). - period_to - Ending date of the reported period (timestamp). Periods are sorted by period_from field ascending. |
serviceids | array | List of service IDs in the reported periods. The sorting order of the list is not defined. Even if serviceids parameter was passed to the sla.getsli method. |
sli | array | SLI data (as a two-dimensional array) for each reported period and service. The index of the periods property is used as the first dimension of the sli property.The index of the serviceids property is used as the second dimension of the sli property. |
The SLI data returned for each reported period and service consists of:
Property | Type | Description |
---|---|---|
uptime | integer | Amount of time service spent in an OK state during scheduled uptime, less the excluded downtimes. |
downtime | integer | Amount of time service spent in a not OK state during scheduled uptime, less the excluded downtimes. |
sli | float | SLI (per cent of total uptime), based on uptime and downtime. |
error_budget | integer | Error budget (in seconds), based on the SLI and the SLO. |
excluded_downtimes | array | Array of excluded downtimes in this reporting period. Each object will contain the following parameters: - name - Name of the excluded downtime. - period_from - Starting date and time (inclusive) of the excluded downtime. - period_to - Ending date and time (exclusive) of the excluded downtime. Excluded downtimes are sorted by period_from field ascending. |
Retrieve SLI on services with IDs "50, 60 and 70" linked to an SLA with ID of "5" for 3 periods starting from Nov 01, 2021.
Request:
{
"jsonrpc": "2.0",
"method": "sla.getsli",
"params": {
"slaid": "5",
"serviceids": [
50,
60,
70
],
"periods": 3,
"period_from": "1635724800"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": {
"periods": [
{
"period_from": 1635724800,
"period_to": 1638316800
},
{
"period_from": 1638316800,
"period_to": 1640995200
},
{
"period_from": 1640995200,
"period_to": 1643673600
}
],
"serviceids": [
50,
60,
70
],
"sli": [
[
{
"uptime": 1186212,
"downtime": 0,
"sli": 100,
"error_budget": 0,
"excluded_downtimes": [
{
"name": "Excluded Downtime - 1",
"period_from": 1637836212,
"period_to": 1638316800
}
]
},
{
"uptime": 1186212,
"downtime": 0,
"sli": 100,
"error_budget": 0,
"excluded_downtimes": [
{
"name": "Excluded Downtime - 1",
"period_from": 1637836212,
"period_to": 1638316800
}
]
},
{
"uptime": 1186212,
"downtime": 0,
"sli": 100,
"error_budget": 0,
"excluded_downtimes": [
{
"name": "Excluded Downtime - 1",
"period_from": 1637836212,
"period_to": 1638316800
}
]
}
],
[
{
"uptime": 1147548,
"downtime": 0,
"sli": 100,
"error_budget": 0,
"excluded_downtimes": [
{
"name": "Excluded Downtime - 1",
"period_from": 1638439200,
"period_to": 1639109652
}
]
},
{
"uptime": 1147548,
"downtime": 0,
"sli": 100,
"error_budget": 0,
"excluded_downtimes": [
{
"name": "Excluded Downtime - 1",
"period_from": 1638439200,
"period_to": 1639109652
}
]
},
{
"uptime": 1147548,
"downtime": 0,
"sli": 100,
"error_budget": 0,
"excluded_downtimes": [
{
"name": "Excluded Downtime - 1",
"period_from": 1638439200,
"period_to": 1639109652
}
]
}
],
[
{
"uptime": 1674000,
"downtime": 0,
"sli": 100,
"error_budget": 0,
"excluded_downtimes": []
},
{
"uptime": 1674000,
"downtime": 0,
"sli": 100,
"error_budget": 0,
"excluded_downtimes": []
},
{
"uptime": 1674000,
"downtime": 0,
"sli": 100,
"error_budget": 0,
"excluded_downtimes": []
}
]
]
},
"id": 1
}
CSla::getSli() in ui/include/classes/api/services/CSla.php