差异化更新告警模板
请求信息
请求行
PATCH /apis/aiops.alauda.io/v1beta1/alerttemplates/{name}
差异化更新指定的告警模板。
请求行参数
| 名称 | 类型 | 是否必填项 | 描述 | 
|---|---|---|---|
| name | string | 是 | 告警模板的名称。 | 
请求参数
| 名称 | 类型 | 是否必填项 | 描述 | 
|---|---|---|---|
| dryRun | string | 否 | 当该参数出现时,表示不应该持久化修改。一个无效的或无法识别的 dryRun 指令将导致错误响应,并且不会进一步处理请求。有效值为:All,将处理所有的试运行阶段。 | 
| fieldManager | string | 否 | fieldManager 是与正在进行这些更改的参与者或实体相关联的名称。值必须少于 128 字符,且仅包含可打印字符,参见 https://golang.org/pkg/unicode/#IsPrint。 | 
| pretty | string | 否 | 如果为 true,则会将返回结果输出成适合打印的格式。 | 
请求体
Content-Type 
                application/json-patch+json,
                application/merge-patch+json,
                application/apply-patch+yaml
请求体示例
Patch 方法,为了给 Kubernetes Patch 请求体一个具体的名称和类型。
{
   "metadata": {
     "annotations": {
       "cpaas.io/operator": "admin@cpaas.io"
     }
   }
 }返回信息
Content-Type 
                application/json,
                application/yaml
状态码: 200
OK
返回体示例
AlertTemplate 是 AlertTemplate API 的结构。
{
   "apiVersion": "aiops.alauda.io/v1beta1",
   "kind": "AlertTemplate",
   "metadata": {
     "annotations": {
       "alert.cpaas.io/notifications": "[]",
       "cpaas.io/creator": "admin@cpaas.io",
       "cpaas.io/description": "abc",
       "cpaas.io/operator": "admin@cpaas.io",
       "cpaas.io/updated-at": "2021-06-23T06:03:06Z"
     },
     "creationTimestamp": "2021-06-10T02:50:48Z",
     "generation": 2,
     "labels": {
       "cpaas.io/kind": "cluster"
     },
     "managedFields": [
       {
         "apiVersion": "aiops.alauda.io/v1beta1",
         "fieldsType": "FieldsV1",
         "fieldsV1": {
           "f:metadata": {
             "f:annotations": {
               ".": {},
               "f:alert.cpaas.io/notifications": {},
               "f:cpaas.io/description": {},
               "f:cpaas.io/updated-at": {}
             },
             "f:labels": {
               ".": {},
               "f:cpaas.io/kind": {}
             }
           },
           "f:spec": {
             ".": {},
             "f:templates": {}
           }
         },
         "manager": "Mozilla",
         "operation": "Update",
         "time": "2021-06-23T06:03:06Z"
       }
     ],
     "name": "test",
     "resourceVersion": "33873778",
     "selfLink": "/apis/aiops.alauda.io/v1beta1/alerttemplates/test",
     "uid": "9eda692f-1483-4fec-8017-c5a908a961ec"
   },
   "spec": {
     "templates": [
       {
         "annotations": {},
         "compare": "\u003e",
         "expr": "",
         "labels": {
           "severity": "High"
         },
         "metric": {
           "queries": [
             {
               "aggregator": "origin",
               "labels": [
                 {
                   "name": "__name__",
                   "type": "EQUAL",
                   "value": "cluster.cpu.utilization"
                 }
               ],
               "range": 0
             }
           ]
         },
         "metric_name": "cluster.cpu.utilization",
         "name": "cluster.cpu.utilization-lxijs",
         "notifications": [],
         "query": "",
         "threshold": 0.5,
         "wait": 30
       }
     ]
   }
 }返回体说明
| 名称 | 类型 | 描述 | 
|---|---|---|
| apiVersion | string | 查看公共参数 | 
| kind | string | 查看公共参数 | 
| metadata | object | 查看公共参数 | 
| spec | object | spec 包含了模板资源的规范参数。 字段路径:spec | 
| spec.templates | array | 告警模板的列表。 字段路径:spec.templates | 
| spec.templates[] | object | 模板项。 字段路径:spec.templates[] | 
| templates[].compare | string | 模板对比信息。 字段路径:spec.templates[].compare | 
| templates[].metric | object | 告警的指标信息。 字段路径:spec.templates[].metric | 
| metric.queries | array | 指标的查询条件。 字段路径:spec.templates[].metric.queries | 
| metric.queries[] | object | 查询项。 字段路径:spec.templates[].metric.queries[] | 
| queries[].aggregator | string | 聚合方式。⽀持以下几种⽅方式:avg:平均值;max:最⼤值;min:最小值。 字段路径:spec.templates[].metric.queries[].aggregator | 
| queries[].labels | array | 告警对象的标签。由键、值组成的监控数据查询条件。 字段路径:spec.templates[].metric.queries[].labels | 
| queries[].labels[] | object | 查询到的标签项。 字段路径:spec.templates[].metric.queries[].labels[] | 
| labels[].name | string | 组合查询条件中包含的键。 字段路径:spec.templates[].metric.queries[].labels[].name | 
| labels[].value | string | 组合查询条件中键对应的值,为资源对象的实际属性值。 字段路径:spec.templates[].metric.queries[].labels[].value | 
| queries[].range | integer | 聚合时间,单位:秒。与聚合算法配合使用,默认为 60s,即使用查询时间前 60 秒内数据进行聚合。 字段路径:spec.templates[].metric.queries[].range | 
| templates[].name | string | 告警范围。 字段路径:spec.templates[].name | 
| templates[].notifications | array | 被该告警触发的通知的信息。 字段路径:spec.templates[].notifications | 
| templates[].threshold | number | 告警阈值。 字段路径:spec.templates[].threshold | 
| templates[].wait | integer | 持续时间,单位:秒。 字段路径:spec.templates[].wait |