Queries alert rules.

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 SearchAlertRules

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

Title String No AlertRuleTitle

The alert rule name.

Type String No 4

The alert rule type. Valid values:

  • 1: custom alert rules to monitor drill-down data sets.
  • 3: custom alert rules to monitor tiled data sets.
  • 4: alert rules to monitor the browser, including the default frontend alert rules.
  • 5: alert rules to monitor applications, including the default application alert rules.
  • 6: the default browser alert rules.
  • 7: the default application alert rules.
  • 8: Tracing Analysis alert rules.
  • 101: Prometheus Service alert rules.
CurrentPage Integer No 1

The page number of the returned page. Default value: 1.

PageSize Integer No 20

The number of entries returned per page. Default value: 10.

RegionId String Yes cn-hangzhou

The region ID of the alert data. For more information about the mappings between RegionId and SystemRegionId, see the detailed description below the table.

Pid String No atc889zkcf@d8deedfa9bf****

The process identifier (PID) of the application that is associated with the alert rule. For more information about how to obtain the PID, see Obtain the PID of an application.

AppType String No TRACE

The type of the application that is associated with the alert rule. Valid values:

  • TRACE: application.
  • RETCODE: browser.
SystemRegionId String No cn-hangzhou

The region ID of the alert rule. For more information about the mappings between RegionId and SystemRegionId, see the detailed description below the table.

Mappings between RegionId and SystemRegionId

The SearchAlertRules API obtains the alert rules of the specified region based on the specified value of SystemRegionId .

  • If the SystemRegionId parameter is not specified, the backend automatically uses the RegionId value as the SystemRegionId value.
  • If the SystemRegionId parameter is specified, RegionId must be specified based on the following mappings. Otherwise data cannot be returned.

RegionId

SystemRegionId

cn-hangzhou: China (Hangzhou)

cn-hangzhou: China (Hangzhou)

cn-hangzhou: China (Hangzhou)

cn-shanghai: China (Shanghai)

cn-hangzhou: China (Hangzhou)

cn-qingdao: China (Qingdao)

cn-hangzhou: China (Hangzhou)

cn-beijing: China (Beijing)

cn-hangzhou: China (Hangzhou)

cn-zhangjiakou: China (Zhangjiakou)

cn-hangzhou: China (Hangzhou)

cn-huhehaote: China (Hohhot)

cn-hangzhou: China (Hangzhou)

cn-shenzhen: China (Shenzhen)

cn-hangzhou: China (Hangzhou)

cn-chengdu: China (Chengdu)

cn-hangzhou: China (Hangzhou)

cn-hongkong: China (Hong Kong)

ap-southeast-1: Singapore (Singapore)

ap-southeast-1: Singapore (Singapore)

ap-southeast-1: Singapore (Singapore)

ap-southeast-2: Australia (Sydney)

ap-southeast-1: Singapore (Singapore)

ap-southeast-3: Malaysia (Kuala Lumpur)

ap-southeast-1: Singapore (Singapore)

ap-southeast-5: Indonesia (Jakarta)

ap-southeast-1: Singapore (Singapore)

ap-south-1: India (Mumbai)

ap-southeast-1: Singapore (Singapore)

me-east-1: UAE (Dubai)

ap-southeast-1: Singapore (Singapore)

ap-southeast-6: Philippines (Manila)

ap-northeast-1: Japan (Tokyo)

ap-northeast-1: Japan (Tokyo)

us-west-1: US (Silicon Valley)

us-west-1: US (Silicon Valley)

us-west-1: US (Silicon Valley)

us-east-1: US (Virginia)

eu-west-1: UK (London)

eu-central-1: Germany (Frankfurt)

eu-west-1: UK (London)

eu-west-1: UK (London)

cn-hangzhou-finance: China East 1 Finance

cn-shanghai-finance-1: China East 2 Finance

cn-hangzhou-finance: China East 1 Finance

cn-hangzhou-finance: China East 1 Finance

For example, to query the alert data of the China (Shanghai) region, you can perform the following operations:

  • Set RegionId to cn-shanghai if the SystemRegionId parameter is not specified.
  • Set RegionId to cn-hangzhou and SystemRegionId to cn-shanghai.

To query the alert rules of the Germany (Frankfurt) region, set RegionId to eu-west-1 and SystemRegionId to eu-central-1.

Response parameters

Parameter Type Example Description
RequestId String 34ED024E-9E31-434A-9E4E-D9D15C3****

The ID of the request.

PageBean Object

The struct returned.

PageNumber Integer 1

The page number of the returned page.

PageSize Integer 20

The number of entries returned per page.

TotalCount Integer 23

The total number of returned entries.

AlertRules Array of AlertRuleEntity

The details of the alert rules.

Status String RUNNING

The status of the alert rule. RUNNING: The alert rule is enabled. STOPPED: The alert rule is disabled.

UpdateTime Long 1480521600000

The timestamp showing when the alert rule was updated.

ContactGroupIdList String 381*,572*

The ID of the contact group. Multiple IDs are separated by commas (,).

CreateTime Long 1579508519683

The timestamp showing when the alert rule was created.

AlertTitle String TestAlertRule

The name of the alert rule.

UserId String 113197164949****

The ID of the user to which the alert rule belongs.

AlertVersion Integer 1

The version of the alert rule. Default value: 1.

HostByAlertManager Boolean true

Indicates whether the alert is sent through the alert center. Valid values:

  • true
  • false
AlertType Integer 4

The type of the alert rule. Valid values:

  • 1: custom alert rules to monitor drill-down data sets.
  • 3: custom alert rules to monitor tiled data sets.
  • 4: alert rules to monitor the browser, including the default frontend alert rules.
  • 5: alert rules to monitor applications, including the default application alert rules.
  • 6: the default browser alert rules.
  • 7: the default application alert rules.
  • 8: Tracing Analysis alert rules.
  • 101: Prometheus alert rules.
ContactGroupIds String [123, 234]

The IDs of the alert contact groups. The value is a JSON array.

Config String {\"continuous\":true,\"dataRevision\":2}

The configuration items of the alert rule. The value is a JSON string.

The configuration item continuous specifies whether to continuously send alert notifications. Valid values:

  • true: Alert notifications are sent every minute.
  • false: The alert silence feature is enabled.

The configuration item dataRevision specifies the data revision policy to be used if no data is obtained or the data is null. Default value: 2. Valid values:

  • 0: overwrites the data by using the value 0.
  • 1: overwrites the data by using the value 1.
  • 2: overwrites the data by using the value null. This value indicates that no alert is triggered if no data exists.
RegionId String cn-hangzhou

The ID of the region to which the alert rule belongs.

AlertLevel String WARN

The severity of the alerts. Only the value WARN is supported.

TaskStatus String ""

The status of the task. This parameter is hidden from users.

Title String AlertTest

The name of the alert.

TaskId Long 123

The ID of the Application Real-Time Monitoring Service (ARMS) task that is associated with the alert rule.

Id Long 123

The ID of the alert rule.

AlertWays Array of String ["MAIL", "SMS", "DING_ROBOT"]

The notification method of the alerts. Valid values:

  • SMS: text message.
  • MAIL: email.
  • DING_ROBOT: DingTalk chatbot.
AlarmContext Object

The format of the alert notification.

AlarmContentTemplate String Alert name: $Alert name\nFilter condition: $Filter\nAlert time: $Alert time\nAlert content: $Alert content\nNote: The alert is continuously triggered until an alert resolution notification email is received. The system will remind you again in 24 hours.

The template of the alert notification.

SubTitle String test

The sub-title of the alert notification.

AlarmContentSubTitle String TestSubTitle

The sub-title of the alert notification content.

Content String Alert name: $Alert name\nFilter condition: $Filter\nAlert time: $Alert time\nAlert content: $Alert content\nNote: The alert is continuously triggered until an alert resolution notification email is received. The system will remind you again in 24 hours.

The content of the alert notification.

AlertRule Object

The conditions of the alert rule. Multiple conditions are separated by the AND or OR logical operators.

Operator String |

The logical operator between conditions. Valid values: &: AND. |: OR.

Rules Array of Rule

The condition of the alert rule.

Measure String appstat.jvm.SystemDiskFree

The metric based on which alerts are triggered. For more information, see the "Alert metrics" section in this topic.

Value Float 30

The threshold of the condition.

Aggregates String AVG

The aggregation logic of the metric data of the alert rule. Valid values:

  • AVG: calculates the average value for each minute.
  • SUM: calculates the total value for each minute.
  • MAX: calculates the maximum value for each minute.
  • MIN: calculates the minimum value for each minute.
NValue Integer 5

The time range to query. Unit: minutes. For example, a value of 5 indicates that the alert rule applies to the data in the last 5 minutes.

Operator String CURRENT_GTE

The operation logic of the condition. Valid values:

  • 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.
Alias String response time_ms

The displayed description of the alert metric.

MetricParam Object

The information about the application that is associated with the alert rule.

Type String db

The type of the metric. Valid values:

  • txn: the number of API calls during application monitoring.
  • txn_type: the types of API calls during application monitoring.
  • db: database metrics.
  • jvm: Java virtual machine (JVM) metrics.
  • host: host metrics.
  • exception: API call errors.
AppGroupId String DEFAULT

The ID of the application group that is associated with the alert rule. This parameter is applicable to Enterprise Distributed Application Service (EDAS) applications.

AppId String 123

The auto-increment ID of the ARMS application. You can ignore this ID.

Pid String 9870ca99-8105-4da7-a3a4-d72dd1b1****

The PID of the application that is associated with the alert rule.

Dimensions Array of Dimension

The dimensions in the condition.

Key String rootIp

The key of the dimension. Valid values:

  • rpc: the name of the API.
  • rpcType: the type of the API call, such as HTTP or DUBBO.
  • endpoint: the name of the database.
  • rootIp: the IP address of the host.
Type String DISABLED

The type of the dimension. Valid values:

  • STATIC: checks only the value of this dimension. In this case, you must set the dimensions.value parameter.
  • ALL: checks the values of all dimensions. The metrics of all API calls are checked. If an API call triggers an alert, the name of the API is displayed in the alert notification. In this case, you do not need to set the dimensions.value parameter.
  • DISABLE: aggregates the values of all dimensions. In this case, you do not need to set the dimensions.value parameter.
Value String "127.0.0.1"

The value of the dimension.

Notice Object

The time ranges when the alert rule takes effect and when alert notifications are sent.

EndTime Long 1480607940000

The end of the time range when the alert rule takes effect within the 24 hours per day. This value is a UNIX timestamp. The year, month, and day that are indicated by the timestamp are not displayed in this value. Only the hour, minute, and second are displayed.

NoticeEndTime Long 1480607940000

The end of the time range when alert notifications are sent based on the alert rule within the 24 hours per day. This value is a UNIX timestamp. The year, month, and day that are indicated by the timestamp are not displayed in this value. Only the hour, minute, and second are displayed.

StartTime Long 1480521600000

The beginning of the time range when the alert rule takes effect within the 24 hours per day. This value is a UNIX timestamp. The year, month, and day that are indicated by the timestamp are not displayed in this value. Only the hour, minute, and second are displayed.

NoticeStartTime Long 1480521600000

The beginning of the time range when alert notifications are sent based on the alert rule within the 24 hours per day. This value is a UNIX timestamp. The year, month, and day that are indicated by the timestamp are not displayed in this value. Only the hour, minute, and second are displayed.

Alert metrics

  • Alert type (metricParam.type): txn
    • Dimension (dimensions.key): rpc
    • Metrics (alertRule.rules.measure):
      • appstat.txn.rt: the response time of API calls (Unit: milliseconds)
      • appstat.txn.count: the number of API calls
      • appstat.txn.errcount: the number of API call errors
  • Alert type (metricParam.type): txn_type
    • Dimension (dimensions.key): rpcType
    • Metrics (alertRule.rules.measure):
      • appstat.inbound.rt: the response time of API calls for services that are provided by the application (Unit: milliseconds)
      • appstat.inbound.count: the number of API calls for services that are provided by the application
      • appstat.inbound.error: the number of API call errors for services that are provided by the application
      • appstat.outbound.rt: the response time of API calls for services on which the application depends (Unit: milliseconds)
      • appstat.outbound.count: the number of API calls for services on which the application depends
      • appstat.outbound.error: the number of API call errors for services on which the application depends
  • Alert type (metricParam.type): db
    • Dimension (dimensions.key): endpoint
    • Metrics (alertRule.rules.measure):
      • appstat.database.rt: the response time of API calls for the database
      • appstat.database.count: the number of API calls for the database
      • appstat.database.errcount: the number of API call errors for the database
  • Alert type (metricParam.type): jvm
    • Dimension (dimensions.key): rootIp
    • Metrics (alertRule.rules.measure):
      • appstat.jvm.heap_used: the total memory space in the JVM heap (Unit: bytes)
      • appstat.jvm.GcPsScavengeCount: the number of garbage collections (GCs) in JVM
      • appstat.jvm.GcPsMarkSweepCount: the number of tag deletions in JVM
      • 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.gc.YoungGcCountInstant: the number of GCs in the young generation
      • appstat.jvm.gc.OldGcCountInstant: the number of full heap GCs (Full GCs) in JVM
      • appstat.jvm.gc.YoungGcTimeInstant: the time that is consumed for the GCs in the young generation (Unit: milliseconds)
      • appstat.jvm.gc.OldGcTimeInstant: the time that is consumed for the Full GCs in JVM (Unit: milliseconds)
      • appstat.jvm.ThreadCount: the total number of JVM threads
      • appstat.jvm.non_heap_used: the used space of the non-heap JVM memory (Unit: bytes)
      • appstat.jvm.non_heap_max: the maximum space of the non-heap JVM memory (Unit: bytes)
      • appstat.jvm.non_heap_init: the initial space of the non-heap JVM memory (Unit: bytes)
      • appstat.jvm.non_heap_committed: the submitted space of the non-heap JVM memory (Unit: bytes)
  • Alert type (metricParam.type): host
    • Dimension (dimensions.key): rootIp
    • Metrics (alertRule.rules.measure):
      • appstat.jvm.SystemCpuUser: the CPU usage of the host (Unit: percentage)
      • appstat.jvm.SystemMemFree: the idle memory space of the host (Unit: bytes)
      • appstat.jvm.SystemDiskFree: the idle disk space of the host (Unit: bytes)
      • appstat.jvm.SystemNetInErrs: the number of error messages that are received by the host
      • appstat.jvm.SystemNetOutErrs: the number of error messages that are sent by the host
      • appstat.jvm.SystemLoad: the system load of the host
  • Alert type (metricParam.type): exception
    • Dimension (dimensions.key): rpc
    • Metrics (alertRule.rules.measure):
      • appstat.exception.rt: the response time of abnormal API calls for the application (Unit: milliseconds)
      • appstat.exception.count: the number of abnormal API calls for the application

Examples

Sample request

http(s)://[Endpoint]/?Action=SearchAlertRules
&Title=AlertRuleTitle
&Type=4
&CurrentPage=1
&PageSize=20
&RegionId=cn-hangzhou
&Pid=atc889zkcf@d8deedfa9bf****
&AppType=TRACE
&SystemRegionId=cn-hangzhou
&Common request parameters

Sample responses

XML format

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

<SearchAlertRulesResponse>
    <RequestId>34ED024E-9E31-434A-9E4E-D9D15C3****</RequestId>
    <PageBean>
        <PageNumber>1</PageNumber>
        <PageSize>20</PageSize>
        <TotalCount>23</TotalCount>
        <AlertRules>
            <Status>RUNNING</Status>
            <UpdateTime>1480521600000</UpdateTime>
            <ContactGroupIdList>381*,572*</ContactGroupIdList>
            <CreateTime>1579508519683</CreateTime>
            <AlertTitle>TestAlertRule</AlertTitle>
            <UserId>113197164949****</UserId>
            <AlertVersion>1</AlertVersion>
            <HostByAlertManager>true</HostByAlertManager>
            <AlertType>4</AlertType>
            <ContactGroupIds>[123, 234]</ContactGroupIds>
            <Config>{\"continuous\":true,\"dataRevision\":2}</Config>
            <RegionId>cn-hangzhou</RegionId>
            <AlertLevel>WARN</AlertLevel>
            <TaskStatus>""</TaskStatus>
            <Title>AlertTest</Title>
            <TaskId>123</TaskId>
            <Id>123</Id>
            <AlertWays>["MAIL", "SMS", "DING_ROBOT"]</AlertWays>
            <AlarmContext>
                <AlarmContentTemplate>Alert name: $Alert name\nFilter condition: $Filter\nAlert time: $Alert time\nAlert content: $Alert content\nNote: The alert is continuously triggered until a reply email is received. The system will remind you again in 24 hours. </AlarmContentTemplate>
                <SubTitle>test</SubTitle>
                <AlarmContentSubTitle>TestSubTitle</AlarmContentSubTitle>
                <Content>Alert name: $Alert name\nFilter condition: $Filter\nAlert time: $Alert time\nAlert content: $Alert content\nNote: The alert is continuously triggered until a reply email is received. The system will remind you again in 24 hours. </Content>
            </AlarmContext>
            <AlertRule>
                <Operator></Operator>
                <Rules>
                    <Measure>appstat.jvm.SystemDiskFree</Measure>
                    <Value>30</Value>
                    <Aggregates>AVG</Aggregates>
                    <NValue>5</NValue>
                    <Operator>CURRENT_GTE</Operator>
                    <Alias>response time_ms</Alias>
                </Rules>
            </AlertRule>
            <MetricParam>
                <Type>DB</Type>
                <AppGroupId>DEFAULT</AppGroupId>
                <AppId>123</AppId>
                <Pid>9870ca99-8105-4da7-a3a4-d72dd1b1****</Pid>
                <Dimensions>
                    <Key>rootIp</Key>
                    <Type>DISABLED</Type>
                    <Value>"127.0.0.1"</Value>
                </Dimensions>
            </MetricParam>
            <Notice>
                <EndTime>1480607940000</EndTime>
                <NoticeEndTime>1480607940000</NoticeEndTime>
                <StartTime>1480521600000</StartTime>
                <NoticeStartTime>1480521600000</NoticeStartTime>
            </Notice>
        </AlertRules>
    </PageBean>
</SearchAlertRulesResponse>

JSON format

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

{
  "RequestId" : "34ED024E-9E31-434A-9E4E-D9D15C3****",
  "PageBean" : {
    "PageNumber" : 1,
    "PageSize" : 20,
    "TotalCount" : 23,
    "AlertRules" : {
      "Status" : "RUNNING",
      "UpdateTime" : 1480521600000,
      "ContactGroupIdList" : "381*,572*",
      "CreateTime" : 1579508519683,
      "AlertTitle" : "TestAlertRule",
      "UserId" : "113197164949****",
      "AlertVersion" : 1,
      "HostByAlertManager" : true,
      "AlertType" : 4,
      "ContactGroupIds" : "[123, 234]",
      "Config" : "{\\\"continuous\\\":true,\\\"dataRevision\\\":2}",
      "RegionId" : "cn-hangzhou",
      "AlertLevel" : "WARN",
      "TaskStatus" : "\"\"",
      "Title" : "AlertTest",
      "TaskId" : 123,
      "Id" : 123,
      "AlertWays" : "[\"MAIL\", \"SMS\", \"DING_ROBOT\"]",
      "AlarmContext" : {
        "AlarmContentTemplate": "Alert name: $Alert name\nFilter condition: $Filter\nAlert time: $Alert time\nAlert content: $Alert content\nNote: The alert is continuously triggered until a reply email is received. The system will remind you again in 24 hours."
        "SubTitle" : "test",
        "AlarmContentSubTitle" : "TestSubTitle",
        "Content": "Alert name: $Alert name\nFilter condition: $Filter\nAlert time: $Alert time\nAlert content: $Alert content\nNote: The alert is continuously triggered until a reply email is received. The system will remind you again in 24 hours."
      },
      "AlertRule" : {
        "Operator" : "",
        "Rules" : {
          "Measure" : "appstat.jvm.SystemDiskFree",
          "Value" : 30,
          "Aggregates" : "AVG",
          "NValue" : 5,
          "Operator" : "CURRENT_GTE",
          "Alias": "response time_ms",
        }
      },
      "MetricParam" : {
        "Type" : "DB",
        "AppGroupId" : "DEFAULT",
        "AppId" : 123,
        "Pid" : "9870ca99-8105-4da7-a3a4-d72dd1b1****",
        "Dimensions" : {
          "Key" : "rootIp",
          "Type" : "DISABLED",
          "Value" : "\"127.0.0.1\""
        }
      },
      "Notice" : {
        "EndTime" : 1480607940000,
        "NoticeEndTime" : 1480607940000,
        "StartTime" : 1480521600000,
        "NoticeStartTime" : 1480521600000
      }
    }
  }
}