This is a translation of the original English documentation page. Help us make it better.

sla.get

Description

integer/array sla.get(object parameters)

The method allows to retrieve SLA objects according to the given parameters.

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.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
slaids string/array Return only SLAs with the given IDs.
serviceids string/array Return only SLAs matching the specific services.
selectSchedule query Return a schedule property with SLA schedules.

Supports count.
selectExcludedDowntimes query Return an excluded_downtimes property with SLA excluded downtimes.

Supports count.
selectServiceTags query Return a service_tags property with SLA serrvice tags.

Supports count.
sortfield string/array Sort the result by the given properties.

Possible values are: slaid, name, period, slo, effective_date, timezone, status and description.
countOutput boolean These parameters being common for all get methods are described in detail in the reference commentary.
editable boolean
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

Повернуті значення

(integer/array) Повертає або:

  • масив об'єктів;
  • кількість отриманих об'єктів, якщо використовувався параметр countOutput.

Приклади

Retrieving all SLAs

Retrieve all data about all SLAs and their properties.

Request:

{
           "jsonrpc": "2.0",
           "method": "sla.get",
           "params": {
               "output": "extend",
               "selectSchedule": ["period_from", "period_to"],
               "selectExcludedDowntimes": ["name", "period_from", "period_to"],
               "selectServiceTags": ["tag", "operator", "value"],
               "preservekeys": true
           },
           "auth": "85dd04b94cbfad794616eb923be13c71",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "1": {
                   "slaid": "1",
                   "name": "Database Uptime",
                   "period": "1",
                   "slo": "99.9995",
                   "effective_date": "1672444800",
                   "timezone": "America/Toronto",
                   "status": "1",
                   "description": "Provide excellent uptime for main SQL database engines.",
                   "service_tags": [
                       {
                           "tag": "Database",
                           "operator": "0",
                           "value": "MySQL"
                       },
                       {
                           "tag": "Database",
                           "operator": "0",
                           "value": "PostgreSQL"
                       }
                   ],
                   "schedule": [
                       {
                           "period_from": "0",
                           "period_to": "601200"
                       }
                   ],
                   "excluded_downtimes": [
                       {
                           "name": "Software version upgrade rollout",
                           "period_from": "1648760400",
                           "period_to": "1648764900"
                       }
                   ]
               }
           },
           "id": 1
       }

Джерело

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