Home / API Documentation / Operations center / Alert templates / Differentiated update alert templates

Differentiated update alert templates

Requests

HTTP request

PATCH /apis/aiops.alauda.io/v1beta1/alerttemplates/{name}

partially update the specified AlertTemplate

Path parameters

Name Type Required Description
name string Truename of the AlertTemplate

Query parameters

Name Type Required Description
dryRun string FalseWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
fieldManager string FalsefieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
pretty string FalseIf 'true', then the output is pretty printed.

Request body

Content-Type application/json-patch+json, application/merge-patch+json, application/apply-patch+yaml

Sample request

Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.

{
   "metadata": {
     "annotations": {
       "cpaas.io/operator": "admin@cpaas.io"
     }
   }
 }

Responses

Content-Type application/json, application/yaml

Status code: 200

OK

Sample response

alertTemplates is the Schema for the 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
       }
     ]
   }
 }

Parameters

Name Type Description
apiVersion string See common parameters
kind string See common parameters
metadata object See common parameters
spec object spec contains specification parameters for a template resource
Path: spec
spec.templates array templates is a list of alert template
Path: spec.templates
spec.templates[] object template item
Path: spec.templates[]
templates[].compare string compare of a template
Path: spec.templates[].compare
templates[].metric object metric info for this alert
Path: spec.templates[].metric
metric.queries array queries array for this metric
Path: spec.templates[].metric.queries
metric.queries[] object a query item
Path: spec.templates[].metric.queries[]
queries[].aggregator string aggregator functions
Path: spec.templates[].metric.queries[].aggregator
queries[].labels array labels for alert object
Path: spec.templates[].metric.queries[].labels
queries[].labels[] object labels item for a query
Path: spec.templates[].metric.queries[].labels[]
labels[].name string label name
Path: spec.templates[].metric.queries[].labels[].name
labels[].value string label value
Path: spec.templates[].metric.queries[].labels[].value
queries[].range integer aggregate range
Path: spec.templates[].metric.queries[].range
templates[].name string alert range
Path: spec.templates[].name
templates[].notifications array notifications triggered by this alert
Path: spec.templates[].notifications
templates[].threshold number alert threshold
Path: spec.templates[].threshold
templates[].wait integer time of duration
Path: spec.templates[].wait

Other status codes

Status code: 401

Unauthorized