这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.

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 service 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() in ui/include/classes/api/services/CSla.php.