这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.
2022 Zabbix中国峰会
2022 Zabbix中国峰会

sla创建

Description

object sla.create(object/array SLAs)

This method allows to create new SLA objects.

This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object/array) SLA objects to create.

Additionally to the standard SLA properties, the method accepts the following parameters.

Parameter Type Description
service_tags
(required)
array SLA service tags to be created for the SLA.
At least one service tag must be specified.
schedule array SLA schedule to be created for the SLA.
Specifying an empty parameter will be interpreted as a 24x7 schedule.
Default: 24x7 schedule.
excluded_downtimes array SLA excluded downtimes to be created for the SLA.

返回值

(object) 返回一个包含已创建 SLA 的 ID 的对象,在slaids属性下。返回的 ID 的顺序匹配通过的 SLA 的顺序。

示例

创建SLA

指示为以下对象创建 SLA 条目: * 跟踪 SQL 引擎相关服务的正常运行时间; * 除周六最后一小时外的所有工作日的自定义时间表; * 生效日期为 2022 年最后一天;¶ * 从 7 月 4 日午夜开始,计划停机时间为 1 小时 15 分钟; * SLA 周报计算将开启; * 可接受的最低 SLO 为 99.9995%。

Request:

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

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "slaids": [
                   "5"
               ]
           },
           "id": 1
       }

来源

CSla::create() in ui/include/classes/api/services/CSla.php.