全部產品
Search
文件中心

Auto Scaling:DescribeAlarms

更新時間:Jan 14, 2025

調用API DescribeAlarms查詢警示任務資訊,及時瞭解已有警示任務的配置和監控項資料的變化趨勢,協助您即時發現系統資源異常,確保系統的穩定性和可靠性。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

請求參數

名稱

類型

是否必選

樣本值

描述

Action String DescribeAlarms

系統規定參數。取值:DescribeAlarms

RegionId String cn-qingdao

警示任務所屬地區的ID。

ScalingGroupId String asg-bp18p2yfxow2dloq****

警示任務關聯的伸縮組的ID。

AlarmTaskId String asg-bp1hvbnmkl10vll5****_f95ce797-dc2e-4bad-9618-14fee7d1****

警示任務ID。

State String OK

警示任務的狀態。取值範圍:

  • ALARM:警示,已滿足警示條件。
  • OK:正常,尚未滿足警示條件。
  • INSUFFICIENT_DATA:資料不足,不足以判斷是否滿足了警示條件。
IsEnable Boolean true

警示任務是否啟用。取值範圍:

  • true:已啟用。
  • false:已停用。
MetricType String system

監控項類型。取值範圍:

  • system:使用CloudMonitor系統指標。
  • custom:使用上報到CloudMonitor的自訂指標。
MetricName String CpuUtilization

監控項名稱。

PageSize Integer 10

分頁查詢時設定的每頁行數。最大值:50。

預設值:10。

PageNumber Integer 1

警示工作清單的頁碼。起始值:1。

預設值:1。

返回資料

名稱

類型

樣本值

描述

PageSize Integer 10

每頁行數。

RequestId String 871C7C53-34A4-45AA-8C14-4B72FA6A****

請求ID。

PageNumber Integer 1

當前頁碼。

TotalCount Integer 2

警示任務的總數。

AlarmList Array of Alarm

警示任務的列表。

Alarm
AlarmTaskId String asg-bp1hvbnmkl10vll5****_f95ce797-dc2e-4bad-9618-14fee7d1****

警示任務ID。

MetricName String CpuUtilization

監控項名稱。可能值:

  • CpuUtilization:(ECS)CPU使用率(%)。
  • ConcurrentConnections:(ECS)ECS同時串連數(個)。
  • IntranetTx:(ECS)內網出流量(Kb/min)。
  • IntranetRx:(ECS)內網入流量(Kb/min)。
  • VpcInternetTx:(ECS)外網出流量(Kb/min)。
  • VpcInternetRx:(ECS)外網入流量(Kb/min)。
  • SystemDiskReadBps:(ECS)系統硬碟讀BPS(Byte/s)。
  • SystemDiskWriteBps:(ECS)系統硬碟寫BPS(Byte/s)。
  • SystemDiskReadOps:(ECS)系統硬碟讀IOPS(次/s)。
  • SystemDiskWriteOps:(ECS)系統硬碟寫IOPS(次/s)。
  • CpuUtilizationAgent:(Agent)CPU使用率(%)。
  • GpuUtilizationAgent:(Agent)GPU使用率(%)。
  • GpuMemoryFreeUtilizationAgent:(Agent)GPU記憶體空閑率(%)。
  • GpuMemoryUtilizationAgent:(Agent)GPU記憶體使用量率(%)。
  • MemoryUtilization:(Agent)記憶體(%)。
  • LoadAverage:(Agent)系統平均負載。
  • TcpConnection:(Agent)TCP總串連數(個)。
  • TcpConnection:(Agent)TCP已建立串連數(個)。
  • PackagesNetOut:(Agent)內網網卡發包數(個/s)。
  • PackagesNetIn:(Agent)內網網卡收包數(個/s)。
  • PackagesNetOut:(Agent)外網網卡發包數(個/s)。
  • PackagesNetIn:(Agent)外網網卡收包數(個/s)。
  • EciPodCpuUtilization:CPU使用率(%)。
  • EciPodMemoryUtilization:記憶體(%)。
  • LoadBalancerRealServerAverageQps:(ALB)伺服器組單機QPS(次/s)。

更多資訊,請參見系統監控警示任務

EvaluationCount Integer 3

觸發執行伸縮規則需要滿足閾值運算式的次數,例如,CPU使用率平均值3次的統計結果均大於等於80%。

State String ALARM

警示任務的狀態。可能值:

  • ALARM:警示,已滿足警示條件。
  • OK:正常,尚未滿足警示條件。
  • INSUFFICIENT_DATA:資料不足,不足以判斷是否滿足了警示條件。
Period Integer 300

統計監控項資料的周期,單位為秒。可能值:

  • 15。
  • 60。
  • 120。
  • 300。
  • 900。
說明 僅ECS類型的伸縮組支援設定15秒的統計周期。
ScalingGroupId String asg-bp18p2yfxow2dloq****

警示任務關聯的伸縮組的ID。

ComparisonOperator String >=

監控項統計值與閾值的比較符,用於指定監控項統計值與閾值在什麼關係下滿足條件。可能值:

  • 監控項統計值大於等於閾值。取值:>=。
  • 監控項統計值小於等於閾值。取值:<=。
  • 監控項統計值大於閾值。取值:>。
  • 監控項統計值小於閾值。取值:<。
Effective String * * * * * ?

指定警示任務的生效時間段。

Description String Test alarm task.

警示任務的描述。

MetricType String system

監控項類型。可能值:

  • system:使用CloudMonitor系統指標。
  • custom:使用上報到CloudMonitor的自訂指標。
Name String TestAlarmTask

警示任務的名稱。

Threshold Float 80.0

監控指標的閾值,滿足閾值運算式達到指定次數即觸發執行伸縮規則。

Enable Boolean true

警示任務是否啟用。可能值:

  • true:已啟用。
  • false:已停用。
Statistics String Average

統計監控項資料的方法。可能值:

  • Average:平均值。
  • Minimum:最小值。
  • Maximum:最大值。
Dimensions Array of Dimension

監控項關聯的維度資訊。

Dimension
DimensionKey String device

監控項關聯的維度資訊鍵,可能值:

  • user_id:您的帳號ID。
  • scaling_group:被監控的伸縮組。
  • device:網卡裝置的類型。
  • state:TCP串連的狀態。
DimensionValue String eth0

監控項關聯的維度資訊值,可能值由維度資訊鍵決定。

  • user_id:由系統自動填滿。
  • scaling_group:由系統自動填滿。
  • device的可能值:
    • eth0:對於傳統網路執行個體,eth0表示內網網卡。對於VPC執行個體,只存在eth0一張網卡。
    • eth1:對於傳統網路執行個體,eth1代表外網網卡。

-state的可能值:

  • TCP_TOTAL:表示總的TCP串連數。
  • ESTABLISHED:表示已建立的TCP串連數。
AlarmActions Array of String ari:acs:ess:cn-hangzhou:1406926474****:scalingrule/asr-bp163l21e07uh****

警示任務關聯伸縮規則的唯一識別碼的列表。

Expressions Array of Expression

多指標警示規則的相關資訊。

Expression
MetricName String CpuUtilization

多指標警示規則的監控指標名稱。可能值:

  • CpuUtilization:(ECS)CPU使用率(%)。
  • ConcurrentConnections:(ECS)ECS同時串連數(個)。
  • IntranetTx:(ECS)內網出流量(Kb/min)。
  • IntranetRx:(ECS)內網入流量(Kb/min)。
  • VpcInternetTx:(ECS)外網出流量(Kb/min)。
  • VpcInternetRx:(ECS)外網入流量(Kb/min)。
  • SystemDiskReadBps:(ECS)系統硬碟讀BPS(Byte/s)。
  • SystemDiskWriteBps:(ECS)系統硬碟寫BPS(Byte/s)。
  • SystemDiskReadOps:(ECS)系統硬碟讀IOPS(次/s)。
  • SystemDiskWriteOps:(ECS)系統硬碟寫IOPS(次/s)。
  • CpuUtilizationAgent:(Agent)CPU使用率(%)。
  • GpuUtilizationAgent:(Agent)GPU使用率(%)。
  • GpuMemoryFreeUtilizationAgent:(Agent)GPU記憶體空閑率(%)。
  • GpuMemoryUtilizationAgent:(Agent)GPU記憶體使用量率(%)。
  • MemoryUtilization:(Agent)記憶體(%)。
  • LoadAverage:(Agent)系統平均負載。
  • TcpConnection:(Agent)TCP總串連數(個)。
  • TcpConnection:(Agent)TCP已建立串連數(個)。
  • PackagesNetOut:(Agent)內網網卡發包數(個/s)。
  • PackagesNetIn:(Agent)內網網卡收包數(個/s)。
  • PackagesNetOut:(Agent)外網網卡發包數(個/s)。
  • PackagesNetIn:(Agent)外網網卡收包數(個/s)。
  • EciPodCpuUtilization:CPU使用率(%)。
  • EciPodMemoryUtilization:記憶體(%)。
  • LoadBalancerRealServerAverageQps:(ALB)伺服器組單機QPS(次/s)。

更多資訊,請參見系統監控警示任務

ComparisonOperator String >=

多指標警示規則的監控項統計值與閾值的比較符,用於指定監控項統計值與閾值在什麼關係下滿足條件。可能值:

  • 監控項統計值大於等於閾值。取值:>=。
  • 監控項統計值小於等於閾值。取值:<=。
  • 監控項統計值大於閾值。取值:>。
  • 監控項統計值小於閾值。取值:<。

預設值:>=。

Period Integer 900

多指標警示規則中統計監控項資料的周期,單位為秒。可能值:

  • 15。
  • 60。
  • 120。
  • 300。
  • 900。
說明 僅ECS類型的伸縮組支援設定15秒的統計周期。
Statistics String Average

多指標警示規則中統計監控項資料的方法。可能值:

  • Average:平均值。
  • Minimum:最小值。
  • Maximum:最大值。
Threshold Float 40.0

多指標警示規則中監控指標的閾值,滿足閾值運算式達到指定次數即觸發執行伸縮規則。

ExpressionsLogicOperator String &&

多指標警示條件之間的關係。可能值:

  • &&:當所有監控指標都符合警示條件時,才能觸發警示。即當多指標警示規則下的運算式均為true時,才能觸發警示。
  • ||:如果其中一個指標符合警示條件,即可觸發警示。

樣本

請求樣本

http(s)://ess.aliyuncs.com/?Action=DescribeAlarms
&RegionId=cn-qingdao
&ScalingGroupId=asg-bp18p2yfxow2dloq****
&AlarmTaskId=asg-bp1hvbnmkl10vll5****_f95ce797-dc2e-4bad-9618-14fee7d1****
&State=OK
&IsEnable=true
&MetricType=system
&MetricName=CpuUtilization
&PageSize=10
&PageNumber=1
&公用請求參數

正常返回樣本

XML格式

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

<DescribeAlarmsResponse>
    <PageSize>10</PageSize>
    <RequestId>871C7C53-34A4-45AA-8C14-4B72FA6A****</RequestId>
    <PageNumber>1</PageNumber>
    <TotalCount>2</TotalCount>
    <AlarmList>
        <AlarmTaskId>asg-bp1hvbnmkl10vll5****_f95ce797-dc2e-4bad-9618-14fee7d1****</AlarmTaskId>
        <MetricName>CpuUtilization</MetricName>
        <EvaluationCount>3</EvaluationCount>
        <State>ALARM</State>
        <Period>300</Period>
        <ScalingGroupId>asg-bp18p2yfxow2dloq****</ScalingGroupId>
        <ComparisonOperator>&gt;=</ComparisonOperator>
        <Effective>* * * * * ?</Effective>
        <Description>Test alarm task.</Description>
        <MetricType>system</MetricType>
        <Name>TestAlarmTask</Name>
        <Threshold>80</Threshold>
        <Enable>true</Enable>
        <Statistics>Average</Statistics>
        <Dimensions>
            <DimensionKey>device</DimensionKey>
            <DimensionValue>eth0</DimensionValue>
        </Dimensions>
        <AlarmActions>ari:acs:ess:cn-hangzhou:1406926474****:scalingrule/asr-bp163l21e07uh****</AlarmActions>
        <Expressions>
            <MetricName>CpuUtilization</MetricName>
            <ComparisonOperator>&gt;=</ComparisonOperator>
            <Period>900</Period>
            <Statistics>Average</Statistics>
            <Threshold>40</Threshold>
        </Expressions>
        <ExpressionsLogicOperator>&amp;&amp;</ExpressionsLogicOperator>
    </AlarmList>
</DescribeAlarmsResponse>

JSON格式

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

{
  "PageSize" : 10,
  "RequestId" : "871C7C53-34A4-45AA-8C14-4B72FA6A****",
  "PageNumber" : 1,
  "TotalCount" : 2,
  "AlarmList" : [ {
    "AlarmTaskId" : "asg-bp1hvbnmkl10vll5****_f95ce797-dc2e-4bad-9618-14fee7d1****",
    "MetricName" : "CpuUtilization",
    "EvaluationCount" : 3,
    "State" : "ALARM",
    "Period" : 300,
    "ScalingGroupId" : "asg-bp18p2yfxow2dloq****",
    "ComparisonOperator" : ">=",
    "Effective" : "* * * * * ?",
    "Description" : "Test alarm task.",
    "MetricType" : "system",
    "Name" : "TestAlarmTask",
    "Threshold" : 80,
    "Enable" : true,
    "Statistics" : "Average",
    "Dimensions" : [ {
      "DimensionKey" : "device",
      "DimensionValue" : "eth0"
    } ],
    "AlarmActions" : [ "ari:acs:ess:cn-hangzhou:1406926474****:scalingrule/asr-bp163l21e07uh****" ],
    "Expressions" : [ {
      "MetricName" : "CpuUtilization",
      "ComparisonOperator" : ">=",
      "Period" : 900,
      "Statistics" : "Average",
      "Threshold" : 40
    } ],
    "ExpressionsLogicOperator" : "&&"
  } ]
}

錯誤碼

訪問錯誤中心查看更多錯誤碼。