Creates or updates an alert rule for Application Monitoring, Browser Monitoring, or Prometheus Service.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateOrUpdateAlertRule

The operation that you want to perform. Set the value to CreateOrUpdateAlertRule.

AlertId Long No 123

The ID of the alert rule.

  • If you do not specify this parameter, a new alert rule is created.
  • If you specify this parameter, the specified alert rule is modified.
AlertName String Yes test-alert

The name of the alert rule.

RegionId String Yes cn-hangzhou

The ID of the region.

AlertType String Yes APPLICATION_MONITORING_ALERT_RULE

The type of the alert rule. Valid values:

  • APPLICATION_MONITORING_ALERT_RULE: alert rule for Application Monitoring
  • BROWSER_MONITORING_ALERT_RULE: alert rule for Browser Monitoring
  • PROMETHEUS_MONITORING_ALERT_RULE: alert rule for Prometheus Service
AlertStatus String No RUNNING

The status of the alert rule.

  • RUNNING (default)
  • STOPPED
NotifyStrategy String No null

The notification policy.

  • If you set this parameter to null, no notification policy is specified. After you create an alert rule, you can create a notification policy and specify match rules and match conditions. For example, you can specify an alert rule name as the match condition. When the alert rule is triggered, an alert event is generated and an alert notification is sent to the contacts or contact groups that are specified in the notification policy.
  • To specify a notification policy, set this parameter to the ID of the notification policy. Application Real-Time Monitoring Service (ARMS) automatically adds a match rule to the notification policy and specifies the ID of the alert rule as the match condition. The name of the alert rule is also displayed. This way, the alert events that are generated based on the alert rule can be matched by the specified notification policy.
Pids String No ["b590lhguqs@40d8deedfa9******"]

The process ID (PID) that is associated with the Application Monitoring or Browser Monitoring alert rule.

AutoAddNewApplication Boolean No false

Specifies whether to apply the alert rule to new applications that are created in Application Monitoring or Browser Monitoring.

  • true: yes
  • false: no
MetricsType String No JVM

The metric type of the Application Monitoring or Browser Monitoring alert rule. For more information, see the following tables.

Filters String No {"DimFilters": [ { "FilterOpt": "ALL", "FilterValues": [], "FilterKey": "rootIp" } ] }

The filter conditions of the Application Monitoring or Browser Monitoring alert rule.

Format:


"DimFilters": [ 
{ 
 "FilterOpt": "ALL",
 "FilterValues": [],         //The value of the filter condition. 
 "FilterKey": "rootIp"     //The Key of the filter condition. 
}
]
                                

Valid values of FilterOpt:

  • STATIC: matches the value of the specified dimension.
  • ALL: matches the values of all dimensions.
  • DISABLE: aggregates the values of all dimensions.
AlertRuleContent String No { "Condition": "OR", "AlertRuleItems": [ { "Operator": "CURRENT_LTE", "MetricKey": "appstat.jvm.threadcount", "Value": 1000, "Aggregate": "AVG", "N": 1 } ] }

The content of the Application Monitoring or Browser Monitoring alert rule. The following code provides an example of the AlertRuleContent parameter. For more information about the meaning of each field, see the supplementary description.

{ "Condition": "OR", "AlertRuleItems": [ { "Operator": "CURRENT_LTE", "MetricKey": "appstat.jvm.threadcount", "Value": 1000, "Aggregate": "AVG", "N": 1 } ] }
Note The conditional fields vary depending on the values of the MetricsType and AlertRuleItems.MetricKey parameters. For more information about the types of metrics supported by Application Monitoring and Browser Monitoring and the alert rule fields corresponding to each metric, see the supplementary description.
AlertCheckType String No STATIC

The alert check type of the Prometheus alert rule.

  • STATIC: a static threshold value. If you set the parameter to STATIC, you must specify the MetricsKey parameter. For more information, see the Correspondence between AlertGroup and MetricsKey for Prometheus Service table.
  • CUSTOM: a custom PromQL statement. If you set the parameter to CUSTOM, you must specify the PromQL, Duration, and Message parameters to create a Prometheus alert rule.
ClusterId String No ceba9b9ea5b924dd0b6726d2de6******

The cluster ID of the Prometheus alert rule.

AlertGroup Long No -1

The alert contact group ID of the Prometheus alert rule.

  • -1: custom PromQL
  • 1: Kubernetes load
  • 15: Kubernetes node
PromQL String No node_memory_MemAvailable_bytes{} / node_memory_MemTotal_bytes{} * 100

The PromQL statement of the Prometheus alert rule.

Duration Long No 1

The duration of the Prometheus alert rule. Unit: minutes.

Level String No P2

The level of the Prometheus alert rule.

  • P1: Alert notifications are sent for major issues that affect the availability of core business, have huge impact, and may lead to serious consequences.
  • P2: Alert notifications are sent for service errors that affect the system availability with relatively limited impact.
  • P3: Alert notifications are sent for issues that may cause service errors or negative effects, or alert notifications for services that are relatively less important.
  • P4: Alert notifications are sent for low-priority issues that do not affect your business.
  • Default: Alert notifications are sent without distinguishing between alert levels.
Message String No Namespace: {{$labels.namespace}} / Pod: {{$labels.pod_name}} / Container: {{$labels.container}} Memory usage > 80%, Current value {{ printf \\\"%.2f\\\" $value }}%

The alert message of the Prometheus alert rule.

Labels String No [ { Value": "cms_polardb", "Name": "_aliyun_cloud_product" } ]

The tags of the Prometheus alert rule.

Annotations String No [ { "Value": "PolarDB slow queries", "Name": "_aliyun_display_name" }

The annotations of the Prometheus alert rule.

MetricsKey String No pop.status.error

The alert metrics. If you set the AlertCheckType parameter to STATIC when you create a Prometheus alert rule, you must specify the MetricsKey parameter.

Note Alert metrics vary depending on the value of the AlertGroup parameter. For more information about the correspondence between AlertGroup and MetricsKey, see the supplementary description.

Description of the AlertRuleContent parameter


{ 
    "Condition": "OR",
     "AlertRuleItems": [
             { "Operator": "CURRENT_LTE",
                 "MetricKey": "appstat.jvm.threadcount",
                 "Value": 1000,
                 "Aggregate": "AVG",
                  "N": 1
            } 
       ]  
  }
            
  • Condition: the relationship between multiple alert conditions.
    • OR: meets any of the specified conditions.
    • AND: meets all the specified conditions.
  • Operator: the comparison operator that is used to compare the metric value with the threshold.
    • CURRENT_GTE: greater than or equal to
    • CURRENT_LTE: less than or equal to
    • PREVIOUS_UP: the minute-to-minute increase percentage
    • PREVIOUS_DOWN: the minute-to-minute decrease percentage
    • HOH_UP: the increase percentage compared with the previous hour
    • HOH_DOWN: the decrease percentage compared with the previous hour
    • DOD_UP: the increase percentage compared with the last day
    • DOD_DOWN: the decrease percentage compared with the last day
  • MetricKey: the metric of the alert condition. Valid values of the MetricKey parameter vary depending on the value of the MetricsType parameter. For more information about the correspondence between the two parameters, see the following tables.
  • Value: the threshold of the alert condition.
  • Aggregate: the aggregation method of the alert condition.
    • AVG: calculates the average value
    • SUM: calculates the total value
    • MAX: selects the maximum value
    • MIN: selects the minimum value
  • N: last N minutes.

Correspondence between MetricsType and AlertRuleContent.AlertRuleItems.MetricKey for Application Monitoring

MetricsType

Metric type

AlertRuleContent.AlertRuleItems.MetricKey

jvm

JVM monitoring

  • appstat.jvm.gc.oldgccountinstant: the number of full heap garbage collections (Full GCs) in JVM
  • appstat.jvm.gc.oldgctimeinstant: the amount of time that is consumed by Full GCs in JVM
  • appstat.jvm.gc.younggccountinstant: the number of GCs in the young generation
  • appstat.jvm.gc.younggctimeinstant: the amount of time that is consumed by GCs in the young generation
  • appstat.jvm.gcg1oldgencount: the number of Garbage-First (G1) GCs in the old generation
  • appstat.jvm.gcg1younggencount: the number of G1 GCs in the young generation
  • appstat.jvm.gcpsmarksweepcount: the number of tag deletions in JVM
  • appstat.jvm.gcpsscavengecount: the number of GCs in JVM
  • appstat.jvm.heap_total: the total memory space in the JVM heap memory
  • appstat.jvm.heap_used: the used space of the JVM heap memory
  • appstat.jvm.non_heap_committed: the submitted space of the non-heap JVM memory
  • appstat.jvm.non_heap_init: the initial space of the non-heap JVM memory
  • appstat.jvm.non_heap_max: the maximum space of the non-heap JVM memory
  • appstat.jvm.non_heap_used: the used space of the non-heap JVM memory
  • appstat.jvm.threadblockedcount: the number of blocked JVM threads
  • appstat.jvm.threadcount: the total number of JVM threads
  • appstat.jvm.threaddeadlockcount: the number of deadlocked JVM threads
  • appstat.jvm.threadnewcount: the number of new JVM threads
  • appstat.jvm.threadrunnablecount: the number of runnable JVM threads
  • appstat.jvm.threadterminatedcount: the number of terminated JVM threads
  • appstat.jvm.threadtimedwaitcount: the number of timed-out JVM threads
  • appstat.jvm.threadwaitcount: the number of waiting JVM threads

saehost

SAE host monitoring

  • appstat.infra.sae.systemcpu: the CPU utilization
  • appstat.infra.sae.systemdiskiopsread: the disk IOPS read
  • appstat.infra.sae.systemdiskiopswrite: the disk IOPS write
  • appstat.infra.sae.systemdiskrate: the disk usage
  • appstat.infra.sae.systemdiskread: the read I/O throughput of the disk
  • appstat.infra.sae.systemdisktotal: the total number of disks
  • appstat.infra.sae.systemdiskused: the number of disks in use
  • appstat.infra.sae.systemdiskwrite: the write I/O throughput of the disk
  • appstat.infra.sae.systemload: the system load
  • appstat.infra.sae.systemmemrate: the memory usage
  • appstat.infra.sae.systemmemtotal: the total memory
  • appstat.infra.sae.systemmemused: the used memory
  • appstat.infra.sae.systemnetrecv: the received bytes
  • appstat.infra.sae.systemnetrecvdrop: the packet loss of received data
  • appstat.infra.sae.systemnetrecverror: the received error packets
  • appstat.infra.sae.systemnetrecvpacket: the received packets
  • appstat.infra.sae.systemnettran: the sent bytes
  • appstat.infra.sae.systemnettrandrop: the packet loss of sent data
  • appstat.infra.sae.systemnettrandrop: the packet loss of sent data
  • appstat.infra.sae.systemnettranpacket: the sent packets

txn_db

SQL metrics

  • appstat.sql.count: the number of database calls
  • appstat.sql.error: the number of database call errors
  • appstat.sql.rt: the response time of database calls

db

Database metrics

  • appstat.database.count: the number of database calls
  • appstat.database.errcount: the number of database call errors
  • appstat.database.rt: the response time of database calls

threadpool

Thread pool monitoring

  • appstat.threadpool.threadcorepoolsize: the number of core threads
  • appstat.threadpool.threadmaxpoolsize: the maximum number of threads
  • appstat.threadpool.threadpoolactivecount: the number of active threads
  • appstat.threadpool.threadpoolqueuesize: the queue size
  • appstat.threadpool.threadpoolsize: the current number of threads
  • appstat.threadpool.threadpooltaskcount: the number of executed tasks
  • appstat.threadpool.threadpoolusedpercent: the thread pool usage

exception

Abnormal API calls

  • appstat.exception.count: the number of abnormal API calls for the application
  • appstat.exception.rt: the response time of abnormal API calls for the application

txn_type

Application call types

  • appstat.incall.count: the number of API calls for the services that are provided by the application
  • appstat.incall.errorrate: the error rate of API calls for the services that are provided by the application
  • appstat.incall.rt: the response time of API calls for the services that are provided by the application
  • appstat.outcall.count: the number of API calls for the services on which the application depends
  • appstat.outcall.errorrate: the error rate of API calls for the services on which the application depends
  • appstat.outcall.rt: the response time of API calls for the services on which the application depends

txn

Application calls

  • appstat.transaction.count: the number of API calls
  • appstat.transaction.error: the number of API call errors
  • appstat.transaction.errorrate: the error rate of API calls
  • appstat.transaction.rt: the response time of API calls

host

Host monitoring

  • appstat.jvm.systemcpuusage: the CPU utilization of the host
  • appstat.jvm.systemcpuuser: the CPU occupancy rate of the host in user mode
  • appstat.jvm.systemdiskfree: the idle disk space of the host
  • appstat.jvm.systemdiskusage: the disk usage of the host
  • appstat.jvm.systemload: the system load of the host
  • appstat.jvm.systemmemfree: the idle memory space of the host
  • appstat.jvm.systemmemusage: the memory usage of the host
  • appstat.jvm.systemnetinerrs: the number of error packets that is received by the host
  • appstat.jvm.systemnetouterrs: the number of error packets that is sent by the host

Correspondence between MetricsType and AlertRuleContent.AlertRuleItems.MetricKey for Browser Monitoring

MetricsType

Metric type

AlertRuleContent.AlertRuleItems.MetricKey

api

API metrics

  • webstat.api.detail.count: the number of API requests
  • webstat.api.detail.fail_time: the amount of time consumed by failed API requests
  • webstat.api.detail.fail_uv: the number of users affected by failed API requests
  • webstat.api.detail.success_rate: the success rate of API requests
  • webstat.api.detail.success_time: the amount of time consumed by successful API requests

page.api

Page API metrics

  • webstat.api.detail.page_api.count: the number of API requests
  • webstat.api.detail.page_api.fail_time: the amount of time consumed by failed API requests
  • webstat.api.detail.page_api.success_rate: the success rate of API requests
  • webstat.api.detail.page_api.success_time: the amount of time consumed by successful API requests

page

Page metrics

  • webstat.api.detail.page_api.fail_uv: the number of users affected by failed API requests
  • webstat.index.pv: the number of page views (PVs)
  • webstat.jserror.count: the number of JS errors
  • webstat.jserror.rate: the JS error rate
  • webstat.msg.top.error_uv: the number of users affected by JS errors
  • webstat.resource.sum: the number of resource errors
  • webstat.satisfy.satisfy: the page satisfaction
  • webstat.speed.avg_cfpt: the custom first paint time (FPT) of the page
  • webstat.speed.avg_ctti: the custom time to interact (TTI) of the page
  • webstat.speed.avg_dns: the DNS query time of the page
  • webstat.speed.avg_dom: the DOM parsing time of the page
  • webstat.speed.avg_fmp: the first meaningful paint (FMP) of the page
  • webstat.speed.avg_fpt: the FPT of the page
  • webstat.speed.avg_load: the amount of time consumed to completely load the page
  • webstat.speed.avg_ready: the ready time
  • webstat.speed.avg_res: the amount of time consumed to load resources
  • webstat.speed.avg_ssl: the amount of time consumed to establish a Secure Sockets Layer (SSL) connection
  • webstat.speed.avg_t1: the custom t1 time of the page
  • webstat.speed.avg_t10: the custom t10 time of the page
  • webstat.speed.avg_t2: the custom t2 time of the page
  • webstat.speed.avg_t3: the custom t3 time of the page
  • webstat.speed.avg_t4: the custom t4 time of the page
  • webstat.speed.avg_t5: the custom t5 time of the page
  • webstat.speed.avg_t6: the custom t6 time of the page
  • webstat.speed.avg_t7: the custom t7 time of the page
  • webstat.speed.avg_t8: the custom t8 time of the page
  • webstat.speed.avg_t9: the custom t9 time of the page
  • webstat.speed.avg_tcp: the amount of time consumed to establish a Transmission Control Protocol (TCP) connection
  • webstat.speed.avg_trans: the amount of time consumed to transfer the content of the page
  • webstat.speed.avg_ttfb: the response time of network requests
  • webstat.speed.avg_tti: the TTI of the page

custom

Custom metrics

  • webstat.avg.avg_val: the average value of reported data
  • webstat.sum.sum_val: the sum of reported data

Correspondence between AlertGroup and MetricsKey for Prometheus Service

AlertGroup

Alert contact group

MetricsKey

1

Kubernetes load

  • prom.workload.container_cpu_usage: the CPU utilization of the container
  • prom.workload.job_execute_error: job failure
  • prom.workload.pod_cpu_usage: the disk usage of the pod
  • prom.workload.pod_start_timeout: startup timeout failure of the pod
  • prom.workload.pod_restart_frequent: frequent restart of the pod
  • prom.workload.pod_status_error: abnormal pod status
  • prom.workload.container_memory_usage: the memory usage of the container
  • prom.workload.deployment_pod_survival: the availability rate of the Deployment pod

15

Kubernetes nodes

  • prom.node.node_memory_usage: the memory usage of the node
  • prom.node.node_cpu_usage: the CPU utilization of the node
  • prom.node.node_disk_usage: the disk usage of the node
  • prom.node.node_status_error: abnormal node status

Response parameters

Parameter Type Example Description
RequestId String 337B8F7E-0A64-5768-9225-E9B3CF******

The ID of the request.

AlertRule Object

The object of the alert rule.

AlertId Float 5510445

The ID of the alert rule.

AlertName String arms-test

The name of the alert rule.

UserId String 1131971649******

The ID of the Alibaba Cloud account.

RegionId String cn-hangzhou

The ID of the region.

AlertType String APPLICATION_MONITORING_ALERT_RULE

The type of the alert rule. Valid values:

  • APPLICATION_MONITORING_ALERT_RULE: alert rule for Application Monitoring
  • BROWSER_MONITORING_ALERT_RULE: alert rule for Browser Monitoring
  • PROMETHEUS_MONITORING_ALERT_RULE: alert rule for Prometheus Service
AlertStatus String RUNNING

The status of the alert rule.

  • RUNNING
  • STOPPED
  • PAUSED
Note The PAUSED status indicates that the alert rule is abnormal and is actively paused by the system. The alert rule may be paused because that it is not unique or the associated cluster has been deleted.
CreatedTime Long 1641438611000

The time when the alert rule was created.

UpdatedTime Long 1641438611000

The time when the alert rule was updated.

Extend String {\"alarmContext\":\"{\\\"content\\\":\\\Alert name: $Alert name\\\\nFilter condition: $Filter condition\\\\nAlert time: $Alert time\\\\nAlert content: $Alert content\\\\nNote: Before you receive an email to clear the alert, the alert is still active and we will remind you again 24 hours later. \\\",\\\"subTitle\\\":\\\"\\\"}\",\"alertWays\":\"[0,1]\",\"contactGroupIds\":\"381,5075\",\"notice\":\"{\\\"endTime\\\":1480607940000,\\\"noticeEndTime\\\":1480607940000,\\\"noticeStartTime\\\":1480521600000,\\\"startTime\\\":1480521600000}\"}

The extended field.

NotifyStrategy String ALERT_MANAGER

The name of the notification policy.

Pids Array of String b590lhguqs@40d8deedfa9******

The PID of the application.

AutoAddNewApplication Boolean false

Indicates whether the alert rule is applied to new applications that are created in Application Monitoring or Browser Monitoring.

  • true: yes
  • false: no
MetricsType String JVM

The metric type of the Application Monitoring or Browser Monitoring alert rule.

AlertRuleContent Object

The content of the Application Monitoring or Browser Monitoring alert rule.

Condition String "|"

The relationship between multiple alert conditions specified for the Application Monitoring or Browser Monitoring alert rule.

  • OR: meets any of the specified conditions.
  • AND: meets all the specified conditions.
AlertRuleItems Array of alertRuleItems

The trigger conditions of the Application Monitoring or Browser Monitoring alert rule.

N Float 1

Indicates the last N minutes.

MetricKey String appstat.jvm.non_heap_used

The metric of the alert condition.

Aggregate String AVG

The aggregation method of the alert condition.

  • AVG: calculates the average value
  • SUM: calculates the total value
  • MAX: selects the maximum value
  • MIN: selects the minimum value
Operator String CURRENT_GTE

The comparison operator that is used to compare the metric value with the threshold.

  • CURRENT_GTE: greater than or equal to
  • CURRENT_LTE: less than or equal to
  • PREVIOUS_UP: the minute-to-minute increase percentage
  • PREVIOUS_DOWN: the minute-to-minute decrease percentage
  • HOH_UP: the increase percentage compared with the previous hour
  • HOH_DOWN: the decrease percentage compared with the previous hour
  • DOD_UP: the increase percentage compared with the last day
  • DOD_DOWN: the decrease percentage compared with the last day
Value String 1

The threshold of the alert condition.

Filters Object

The filter conditions of the Application Monitoring or Browser Monitoring alert rule.

DimFilters Array of dimFilters

The information about each filter condition of the Application Monitoring or Browser Monitoring alert rule.

FilterKey String rootIp

The key of the filter condition.

FilterOpt String ALL

The logical operator of the filter condition.

FilterValues Array of String []

The value of the filter condition.

CustomSLSFilters Array of customSLSFilters

The custom filter condition of the Browser Monitoring alert rule.

Key String username

The key of the filter condition.

Opt String =

The logical operator of the filter condition.

  • =: equal to
  • not: not equal to
Value String test

The value of the filter condition.

T String null

This field is used only to distinguish the type of Browser Monitoring logs. Other filter conditions do not include this field.

Show Boolean false

Indicates whether this filter condition is displayed on the frontend.

CustomSLSGroupByDimensions Array of String ["page"]

The value of the aggregation dimension.

CustomSLSWheres Array of String ["t like '%api%'"]

The value of the custom filter condition.

AlertCheckType String STATIC

The alert check type of the Prometheus alert rule.

  • STATIC: a static threshold value.
  • CUSTOM: a custom PromQL statement.
ClusterId String ceba9b9ea5b924dd0b6726d2de6******

The cluster ID of the Prometheus alert rule.

AlertGroup Long -1

The alert contact group ID of the Prometheus alert rule.

  • -1: custom PromQL
  • 1: Kubernetes load
  • 15: Kubernetes node
PromQL String node_memory_MemAvailable_bytes{} / node_memory_MemTotal_bytes{} * 100

The PromQL statement of the Prometheus alert rule.

Duration String 1

The duration of the Prometheus alert rule. Unit: minutes.

Level String P2

The level of the Prometheus alert rule.

  • P1: Alert notifications are sent for major issues that affect the availability of core business, have huge impact, and may lead to serious consequences.
  • P2: Alert notifications are sent for service errors that affect the system availability with relatively limited impact.
  • P3: Alert notifications are sent for issues that may cause service errors or negative effects, or alert notifications for services that are relatively less important.
  • P4: Alert notifications are sent for low-priority issues that do not affect your business.
  • Default: Alert notifications are sent without distinguishing between alert levels.
Message String Namespace: {{$labels.namespace}} / Pod: {{$labels.pod_name}} / Container: {{$labels.container}} Memory usage > 80%, Current value {{ printf \\\"%.2f\\\" $value }}%

The alert message of the Prometheus alert rule.

Labels Array of labels

The tags of the Prometheus alert rule.

Name String 123

The key of the tag.

Value String abc

The value of the tag.

Annotations Array of annotations

The annotations of the Prometheus alert rule.

Name String 123

The key of the annotation.

Value String abc

The value of the annotation.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateOrUpdateAlertRule
&AlertId=123
&AlertName=test-alert
&RegionId=cn-hangzhou
&AlertType=APPLICATION_MONITORING_ALERT_RULE
&AlertStatus=RUNNING
&NotifyStrategy=null
&Pids=b590lhguqs@40d8deedfa9******
&AutoAddNewApplication=false
&MetricsType=JVM
&Filters={           "DimFilters": [             {               "FilterOpt": "ALL",               "FilterValues": [],               "FilterKey": "rootIp"             }           ]         }
&AlertRuleContent={ "Condition": "OR", "AlertRuleItems": [ { "Operator": "CURRENT_LTE",  "MetricKey": "appstat.jvm.threadcount",  "Value": 1000,  "Aggregate": "AVG",   "N": 1  }  ]  }
&AlertCheckType=STATIC
&ClusterId=ceba9b9ea5b924dd0b6726d2de6******
&AlertGroup=-1
&PromQL=node_memory_MemAvailable_bytes{} / node_memory_MemTotal_bytes{} * 100
&Duration=1
&Level=P2
&Message=Namespace: {{$labels.namespace}} / Pod: {{$labels.pod_name}} / Container: {{$labels.container}} Memory usage > 80%, Current value {{ printf \\\"%.2f\\\" $value }}%
&Labels=[  {  Value": "cms_polardb",             "Name": "_aliyun_cloud_product"           }         ]
&Annotations=[    { "Value": "PolarDB slow queries",             "Name": "_aliyun_display_name"           }
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateOrUpdateAlertRuleResponse>
    <RequestId>337B8F7E-0A64-5768-9225-E9B3CF******</RequestId>
    <AlertRule>
        <AlertId>5510445</AlertId>
        <AlertName>arms-test</AlertName>
        <UserId>1131971649******</UserId>
        <RegionId>cn-hangzhou</RegionId>
        <AlertType>APPLICATION_MONITORING_ALERT_RULE</AlertType>
        <AlertStatus>RUNNING</AlertStatus>
        <CreatedTime>1641438611000</CreatedTime>
        <UpdatedTime>1641438611000</UpdatedTime>
        <Extend>{\"alarmContext\":\"{\\\"content\\\":\\\Alert name: $Alert name\\\\nFilter condition: $Filter condition\\\\nAlert time: $Alert time\\\\nAlert content: $Alert content\\\\nNote: Before you receive an email to clear the alert, the alert is still active and we will remind you again 24 hours later. \\\",\\\"subTitle\\\":\\\"\\\"}\",\"alertWays\":\"[0,1]\",\"contactGroupIds\":\"381,5075\",\"notice\":\"{\\\"endTime\\\":1480607940000,\\\"noticeEndTime\\\":1480607940000,\\\"noticeStartTime\\\":1480521600000,\\\"startTime\\\":1480521600000}\"}</Extend>
        <NotifyStrategy>ALERT_MANAGER</NotifyStrategy>
        <Pids>b590lhguqs@40d8deedfa9******</Pids>
        <AutoAddNewApplication>false</AutoAddNewApplication>
        <MetricsType>JVM</MetricsType>
        <AlertRuleContent>
            <Condition>"|"</Condition>
            <AlertRuleItems>
                <N>1</N>
                <MetricKey>appstat.jvm.non_heap_used</MetricKey>
                <Aggregate>AVG</Aggregate>
                <Operator>CURRENT_GTE</Operator>
                <Value>1</Value>
            </AlertRuleItems>
        </AlertRuleContent>
        <Filters>
            <DimFilters>
                <FilterKey>rootIp</FilterKey>
                <FilterOpt>ALL</FilterOpt>
                <FilterValues>[]</FilterValues>
            </DimFilters>
            <CustomSLSFilters>
                <Key>username</Key>
                <Opt>=</Opt>
                <Value>test</Value>
                <T>null</T>
                <Show>false</Show>
            </CustomSLSFilters>
            <CustomSLSGroupByDimensions>["page"]</CustomSLSGroupByDimensions>
            <CustomSLSWheres>["t like '%api%'"]</CustomSLSWheres>
        </Filters>
        <AlertCheckType>STATIC</AlertCheckType>
        <ClusterId>ceba9b9ea5b924dd0b6726d2de6******</ClusterId>
        <AlertGroup>-1</AlertGroup>
        <PromQL>node_memory_MemAvailable_bytes{} / node_memory_MemTotal_bytes{} * 100</PromQL>
        <Duration>1</Duration>
        <Level>P2</Level>
        <Message>Namespace: {{$labels.namespace}} / Pod: {{$labels.pod_name}} / Container: {{$labels.container}} Memory usage > 80%, Current value {{ printf \\\"%.2f\\\" $value }}%</Message>
        <Labels>
            <Name>123</Name>
            <Value>abc</Value>
        </Labels>
        <Annotations>
            <Name>123</Name>
            <Value>abc</Value>
        </Annotations>
    </AlertRule>
</CreateOrUpdateAlertRuleResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "337B8F7E-0A64-5768-9225-E9B3CF******",
  "AlertRule" : {
    "AlertId" : 5510445,
    "AlertName" : "arms-test",
    "UserId" : "1131971649******",
    "RegionId" : "cn-hangzhou",
    "AlertType" : "APPLICATION_MONITORING_ALERT_RULE",
    "AlertStatus" : "RUNNING",
    "CreatedTime" : 1641438611000,
    "UpdatedTime" : 1641438611000,
    "Extend" : "{\\\"alarmContext\\\":\\\"{\\\\\\\"content\\\\\\\":\\\\\\\"Alert name: $Alert name\\\\\\\\nFilter condition: $Filter condition\\\\\\\\nAlert time: $Alert time\\\\\\\\nAlert content: $Alert content\\\\\\\\nNote: Before you receive an email to clear the alert, the alert is still active and we will remind you again 24 hours later. \\\\\\\",\\\\\\\"subTitle\\\\\\\":\\\\\\\"\\\\\\\"}\\\",\\\"alertWays\\\":\\\"[0,1]\\\",\\\"contactGroupIds\\\":\\\"381,5075\\\",\\\"notice\\\":\\\"{\\\\\\\"endTime\\\\\\\":1480607940000,\\\\\\\"noticeEndTime\\\\\\\":1480607940000,\\\\\\\"noticeStartTime\\\\\\\":1480521600000,\\\\\\\"startTime\\\\\\\":1480521600000}\\\"}",
    "NotifyStrategy" : "ALERT_MANAGER",
    "Pids" : [ "b590lhguqs@40d8deedfa9******" ],
    "AutoAddNewApplication" : false,
    "MetricsType" : "JVM",
    "AlertRuleContent" : {
      "Condition" : "\"|\"",
      "AlertRuleItems" : [ {
        "N" : 1,
        "MetricKey" : "appstat.jvm.non_heap_used",
        "Aggregate" : "AVG",
        "Operator" : "CURRENT_GTE",
        "Value" : "1"
      } ]
    },
    "Filters" : {
      "DimFilters" : [ {
        "FilterKey" : "rootIp",
        "FilterOpt" : "ALL",
        "FilterValues" : [ "[]" ]
      } ],
      "CustomSLSFilters" : [ {
        "Key" : "username",
        "Opt" : "=",
        "Value" : "test",
        "T" : "null",
        "Show" : false
      } ],
      "CustomSLSGroupByDimensions" : [ "[\"page\"]" ],
      "CustomSLSWheres" : [ "[\"t like '%api%'\"]" ]
    },
    "AlertCheckType" : "STATIC",
    "ClusterId" : "ceba9b9ea5b924dd0b6726d2de6******",
    "AlertGroup" : -1,
    "PromQL" : "node_memory_MemAvailable_bytes{} / node_memory_MemTotal_bytes{} * 100",
    "Duration" : "1",
    "Level" : "P2",
    "Message" : "Namespace: {{$labels.namespace}} / Pod: {{$labels.pod_name}} / Container: {{$labels.container}} Memory usage > 80%, Current value {{ printf \\\\\\\"%.2f\\\\\\\" $value }}%",
    "Labels" : [ {
      "Name" : "123",
      "Value" : "abc"
    } ],
    "Annotations" : [ {
      "Name" : "123",
      "Value" : "abc"
    } ]
  }
}

Error codes

For a list of error codes, visit the API Error Center.