# Custom SLA reports API
Warning
Additional authorization is required to fulfill any request.
Use in the request the header Authorization: Bearer <Personal Token>
.
- Getting a list of available SLA templates
- Creating a custom SLA report
- Getting the status of execution of a custom report by identifier
- Exporting a custom report file
- Request parameters
- An example of event report export file in JSON format for regular SLA template
- Attributes of event report export file in JSON format for regular SLA template
- An example of CI availability report export file in JSON format for regular SLA template
- Attributes of CI availability report export file in JSON format for regular SLA template
- An example of CI availability report export file in CSV format for regular SLA template
- Attributes of CI availability report export file in CSV format for regular SLA template
- Output model example for multi-template in JSON format
- Output model attributes for multi-template
- Sample CSV export file for regular SLA template
- Description of fields in CSV export file for regular SLA template
- Sample CSV export file for SLA multi-template
- Description of fields in CSV export file for SLA multi-template
- Response codes
# Getting a list of available SLA templates
GET /api/public/sm/v1/sla/templates
# Request parameters
Request has no parameters
# Output model example
[
{
"id": 1,
"type": "Single",
"name": "SLA template",
"description": "sample SLA template",
"period": "Today",
"ownerType": "User",
"userId": 1268,
"workGroup": null
},
{
"id": 2,
"type": "Multi",
"name": "SLA multitemplate",
"description": "sample SLA multitemplate",
"period": "ThisMonth",
"ownerType": "WorkGroup",
"userId": null,
"workGroup": {
"id": 1,
"userspaceId": 1,
"name": "Sample WorkGroup",
"managerId": 1268
}
]
# Output model attributes
Attribute | Type | Description |
---|---|---|
id | long | Identifier of the SLA template. |
type | string | SLA template type. "Single" for regular template and "Multi" for multi-template. |
name | string | The name of the SLA template. |
description | string | Description of the SLA template. |
period | string | The default calculation interval for the template. |
ownerType | string | The owner type of the SLA template. |
userId | long | The ID of the user who owns the SLA template. Null if a workgroup owns the template. |
workGroup | object | The view model of the workgroup that owns the SLA template. Null if a user owns the template. |
Possible values for the period
attribute:
"ThisYear"
- current year"ThisQuarter"
- current quarter"ThisMonth"
- current month"ThisWeek"
- current week"Today"
- current day"PreviousYear"
- previous year"PreviousQuarter"
- previous quarter"PreviousMonth"
- previous month"PreviousWeek"
- previous week"Yesterday"
- previous day
Possible values for the ownerType
attribute:
"User"
- user"WorkGroup"
- workgroup
# Response codes
Code | Description |
---|---|
200 | The request was successfully completed. |
401 | The user is not authorized. |
403 | Insufficient rights to view SLA templates. |
500 | An unexpected error occurred while processing the request. |
# Creating a custom SLA report
A custom report can only be created for an existing SLA template. Users creating custom reports must have the right to read the specified SLA template in the request body. The storage period for a customized report is one day. After this period has expired, it is not possible to export the calculation results.
POST /api/public/sm/v1/sla/ordered
# Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
template | object | yes | Identifier of the SLA report template for which the calculation is ordered. |
range | object | no | The interval for calculating the SLA report. If not specified, it is taken from the template model. |
# Input model example
{
"template": { "id": 1 },
"range": {
"start": "2021-10-10T00:00:00+03:00",
"end": "2021-10-11T00:00:00+03:00"
}
}
# Output model example
{
"id": "1b42209c-e239-44fe-94b1-a2072c8f70c2",
"reportId": null,
"start": "2021-10-10T00:00:00+03:00",
"end": "2021-10-11T00:00:00+03:00",
"template": {
"id": 1,
"name": "Sample template",
"type": "Single",
"period": "ThisWeek",
"ownerType": "User",
"userId": 1268,
"workGroup": null
},
"status": "Pending",
"error": null,
"ownerType": "User",
"userId": 1268,
"workGroup": null
}
# Output model attributes
Attribute | Type | Description |
---|---|---|
id | string | Custom report identifier (Guid) |
reportId | string | Identifier of the SLA report |
start | dateTime | Beginning of the calculated SLA interval |
end | dateTime | End of the calculated SLA interval |
template | object | SLA report template used for calculation |
status | string | Custom report status |
error | string | Error message that stopped the calculation |
ownerType | string | Owner type of custom report |
userId | long | ID of the user who owns the report |
workgroup | object | The model of the workgroup that owns the template |
Possible values for the status
attribute:
"Pending"
- pending execution"Ok"
- ready"Error"
- SLA calculation completed with an error (the error message is contained in theerror
attribute)
# Response codes
Code | Description |
---|---|
200 | The request was successfully completed. |
401 | The user is not authorized. |
403 | Insufficient rights to view SLA templates. |
500 | An unexpected error occurred while processing the request. |
# Getting the status of execution of a custom report by identifier
GET /api/public/sm/v1/sla/ordered/{id}
# Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
id | string | yes | Identifier of the custom report |
# Output model example
{
"id": "1b42209c-e239-44fe-94b1-a2072c8f70c2",
"reportId": "c7404180a98c6a7ea7fe593f95e52e1991a1eeb0",
"start": "2021-10-10T00:00:00+03:00",
"end": "2021-10-11T00:00:00+03:00",
"template": {
"id": 1,
"name": "Sample template",
"type": "Single",
"period": "ThisWeek",
"ownerType": "User",
"userId": 1268,
"workGroup": null
},
"status": "Ok",
"error": null,
"ownerType": "User",
"userId": 1268,
"workGroup": null
}
# Response codes
Code | Description |
---|---|
200 | The request was successfully completed. |
400 | Invalid custom report ID value. |
401 | The user is not authorized. |
403 | Insufficient rights to view this custom report. |
404 | A custom report with the specified ID was not found. |
500 | An unexpected error occurred while processing the request. |
Warning
On one instance of the sm-sla-service-ordered
microservice, calculations are performed sequentially. For parallel execution of calculations, it is necessary to add the number of sm-sla-service-ordered
microservice replicas to Kubernetes.
# Exporting a custom report file
GET /api/public/sm/v1/sla/ordered/{id}/export?format=csv&exportType={exportType}
# Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
id | string | yes | The custom report ID |
format | string | no | Export file format |
exportType | string | no | Export type:events - export by events,configItems - export by CIs,Default: events |
The following formats are available for export:
"xls"
- Excel spreadsheet (default),"csv"
- CSV file,"json"
- JSON file .
# An example of event report export file in JSON format for regular SLA template
[
{
"id": "f3d29998-56c4-4075-b53f-8d0120923cb3",
"isIncluded": true,
"trigger": {
"id": 74198,
"name": "Test Smirnov"
},
"dateStart": "2020-02-19T17:00:46+00:00",
"dateEnd": "2020-10-28T07:10:32.013+00:00",
"duration": 21737386000,
"priority": "Problem2",
"tags": [
{
"id": 50,
"name": "yellow",
"colorName": "pink"
}
],
"configItems": [
{
"id": 7884247,
"name": "New CI",
"configItemType": {
"id": 10,
"name": "Virtual server",
"description": null,
"icon": {
"id": 9,
"name": "settings_system_daydream",
"fileName": null,
"userspaceId": 1,
"iconUrl": "/api/sm/rsm/icons/9/icon"
},
"userspaceId": 17
},
"withMaintenance": true,
"influence": {
"value": 7.874981367858503,
"maxInfluence": false
},
"isIncluded": true
}
],
"influence": {
"value": 7.874981367858503,
"maxInfluence": false
},
"incidents": [
{
"connector": {
"id": 1,
"name": "HPSM Service Desk"
},
"incidents": [
{
"id": "IM88753",
"type": "hpsm"
}
]
}
]
}
]
# Attributes of event report export file in JSON format for regular SLA template
Attribute | Type | Description |
---|---|---|
id | string | Custom report identifier |
isIncluded | boolean | Is the event taken into account in the calculation of SLA |
trigger | object | Event synthetic trigger |
dateStart | dateTime | Event start date |
dateEnd | dateTime | Event end date. Null if the event is not over |
duration | long | Duration of the event |
priority | string | Event priority |
tags | object [] | Event list of tags |
configItems | object [] | List of CIs associated with the event |
influence | float | Impact of the event on the overall availability of CI |
incidents | object [] | List of incidents associated with the event |
# An example of CI availability report export file in JSON format for regular SLA template
[
{
"configItem": {
"id": 2444,
"name": "Sample CI",
"configItemType": {
"id": -1,
"name": "Default",
"description": "Type by default",
"icon": {
"id": -1,
"name": "layers",
"fileName": "layers.svg",
"userspaceId": 0,
"iconUrl": "/api/sm/rsm/icons/-1/icon"
},
"userspaceId": 0
},
"isIncluded": true,
"withMaintenance": false,
"influence": {
"value": 0.0,
"maxInfluence": false
},
"serviceAvailability": 100.0
},
"okTime": {
"percent": 100.0,
"value": 86400000
},
"problemTime": {
"percent": 0.0,
"value": 0
},
"unattendedTime": {
"percent": 0.0,
"value": 0
},
"maintenanceTime": {
"percent": 0.0,
"value": 0
},
"serviceAvailability": 100.0,
"maxDowntime": 0,
"problem1EventsCount": 0,
"problem2EventsCount": 0,
"problem3EventsCount": 0,
"problem4EventsCount": 0,
"eventsCount": 0
}
]
# Attributes of CI availability report export file in JSON format for regular SLA template
Attribute | Type | Description |
---|---|---|
configItem | object | CI for which the availability calculation was made. |
eventsCount | long | The number of events. |
maintenanceTime | object | Object with information about the time when the CI was in the maintenance mode. |
maxDowntime | long | Maximum idle time (in seconds). |
okTime | object | An object with information about the time when the CI met the SLA. |
problem1EventsCount | long | Number of events with priority 1. |
problem2EventsCount | long | Number of events with priority 2. |
problem3EventsCount | long | Number of events with priority 3. |
problem4EventsCount | long | Number of events with priority 4. |
problemTime | object | An object with information about the time when the CI did not meet the SLA. |
serviceAvailability | float | Availability of CI (in percent). |
unattendedTime | object | An object with information about the non-working time of the CI. |
# An example of CI availability report export file in CSV format for regular SLA template
Id,Name,ConfigItemType,Influence,ServiceAvailability,ServiceAvailabilityTime,ProblemTimePercent,ProblemTime,AttendedTime,UnattendedTime,MaintenanceTime,EventsCount,Problem1EventsCount,Problem2EventsCount,Problem3EventsCount,Problem4EventsCount,MaxDownTime
2444,"Sample CI",Default,0,100,86400,0,0,86400,0,0,0,0,0,0,0,0
2445,"HQ",Default,0,100,86400,0,0,86400,0,0,0,0,0,0,0,0
2447,"CRM",Default,1.1719065313447727,0,0,100,86400,86400,0,0,1,0,0,0,1,86400
# Attributes of CI availability report export file in CSV format for regular SLA template
Attribute | Type | Description |
---|---|---|
id | long | CI identifier. |
name | string | CI name. |
ConfigItemType | string | CI Type name. |
influence | float | Impact of CI on overall accessibility. |
ServiceAvailability | float | Availability value for the period (in percent). |
ServiceAvailabilityTime | long | The total time during which the CI was in a state that satisfies the SLA (in seconds). |
ProblemTimePercent | float | The percentage of the total time that the CI was in a state that did not meet the SLA. |
ProblemTime | long | The total time during which the CI was in a state that did not meet the SLA (in seconds). |
AttendedTime | long | The total working time of the CI (in seconds). |
UnattendedTime | long | Total non-working time of CI (in seconds). |
MaintenanceTime | long | The total agreed idle time during which the CI was in the maintenance mode (in seconds). |
EventsCount | long | The number of events. |
Problem1EventsCount | long | Number of events with priority 1. |
Problem2EventsCount | long | Number of events with priority 2. |
Problem3EventsCount | long | Number of events with priority 3. |
Problem4EventsCount | long | Number of events with priority 4. |
MaxDowntime | long | Maximum idle time (in seconds). |
# Output model example for multi-template in JSON format
[
{
"name": "Template 1",
"weight": 0.5,
"influence": 50.0,
"serviceAvailability": 0.0,
"okTime": 0,
"problemTimePercent": 100.0,
"problemTime": 2647832326,
"attendedTime": 2647832326,
"unattendedTime": 0,
"maintenanceTime": 0,
"eventsCount": 10,
"problem1EventsCount": 3,
"problem2EventsCount": 3,
"problem3EventsCount": 1,
"problem4EventsCount": 3,
"maxDownTime": 2647832326
},
{
"name": "Template 2",
"weight": 0.5,
"influence": 50.0,
"serviceAvailability": 0.0,
"okTime": 0,
"problemTimePercent": 100.0,
"problemTime": 2647832326,
"attendedTime": 2647832326,
"unattendedTime": 0,
"maintenanceTime": 0,
"eventsCount": 1,
"problem1EventsCount": 0,
"problem2EventsCount": 0,
"problem3EventsCount": 0,
"problem4EventsCount": 1,
"maxDownTime": 2647832326
}
]
# Output model attributes for multi-template
Attribute | Type | Description |
---|---|---|
name | string | Template name |
weight | float | Template weight |
influence | float | Influence of the template on the final result of the multi-template SLA calculation |
serviceAvailability | float | Percentage of availability for the period |
okTime | long | Cumulative time during which CIs met the SLA (in milliseconds) |
problemTimePercent | float | Percentage of total time during which CIs were in a state that did not meet SLA |
problemTime | long | The total time during which the CIs were in a state that did not meet the SLA (in milliseconds) |
attendedTime | long | Total working time of CI (in milliseconds) |
unattendedTime | long | Cumulative non-working time of CI (in milliseconds) |
maintenanceTime | long | The total time of agreed idle time during which the CIs were in the maintenance mode (in milliseconds) |
eventsCount | long | Number of events |
problem1EventsCount | long | Number of events with priority 1 |
problem2EventsCount | long | Number of events with priority 2 |
problem3EventsCount | long | Number of events with priority 3 |
problem4EventsCount | long | Number of events with priority 4 |
maxDownTime | long | Maximum idle time (in milliseconds) |
# Sample CSV export file for regular SLA template
Id,Problem,Priority,Start,End,Duration,InfluencedCI,Tags,Incidents
f3d29998-56c4-4075-b53f-8d0120923cb3,Test Smirnov,Problem2,19.02.2020 20:00,28.10.2020 10:10,21737386,ConfigItem1,SampleTag,"Incident1,Incident2"
9b3a1272-6f51-456b-8d08-9a77f204c652,Test Smirnov,Problem3,28.10.2020 10:23,28.10.2020 10:32,539,"ConfigItem1,ConfigItem2",,
# Description of fields in CSV export file for regular SLA template
Filed | Type | Description |
---|---|---|
Id | string | Event ID |
Problem | string | Event name |
Priority | string | Event Priority |
Start | dateTime | Event start time |
End | dateTime | Event end time |
Duration | long | Event duration (in seconds) |
InfluencedCI | string | List of CIs impacted by the event |
Tags | string | Event tags |
Incidents | string | Event related incidents |
# Sample CSV export file for SLA multi-template
Name,Weight,Influence,ServiceAvailability,OkTime,ProblemTimePercent,ProblemTime,AttendedTime,UnattendedTime,MaintenanceTime,EventsCount,Problem1EventsCount,Problem2EventsCount,Problem3EventsCount,Problem4EventsCount,MaxDownTime
template_1,0.9803921568627451,98.03921568627452,0,0,100,2505600,2505600,0,0,296,103,75,62,56,2505600
template_2,0.0196078431372549,1.9607843137254906,0,0,100,2505600,2505600,0,0,32,5,27,0,0,2505600
# Description of fields in CSV export file for SLA multi-template
Filed | Type | Description |
---|---|---|
Name | string | Template name |
Weight | float | Template weight |
Influence | float | Influence of the template on the final result of the multi-template SLA calculation |
ServiceAvailability | float | Percentage of availability for the period |
OkTime | long | The total time during which the CIs met the SLA (in seconds) |
ProblemTimePercent | float | Percentage of total time during which the CIs were in a state that did not meet SLA |
ProblemTime | long | The total time during which the CIs were in a state that did not meet the SLA (in seconds) |
AttendedTime | long | Total working time of CI (in seconds) |
UnattendedTime | long | Cumulative non-working time of CI (in seconds) |
MaintenanceTime | long | The total time of agreed downtime during which the CIs were in the maintenance mode (in seconds) |
EventsCount | long | Number of events |
Problem1EventsCount | long | Number of events with priority 1 |
Problem2EventsCount | long | Number of events with priority 2 |
Problem3EventsCount | long | Number of events with priority 3 |
Problem4EventsCount | long | Number of events with priority 4 |
MaxDownTime | long | Maximum downtime period |
# Response codes
Code | Description |
---|---|
200 | The request was successfully completed. |
400 | Empty request body. |
400 | The custom report is not ready yet. |
401 | Failed to authorize the user. |
403 | Insufficient rights to read the custom report. |
500 | An unexpected error occurred while processing the request. |