通過API DescribeScalingActivities查看伸縮活動的詳情,瞭解通過定時任務、警示任務或手動執行伸縮規則等方式觸發伸縮活動的結果。例如,您可以在伸縮活動詳情頁查看到伸縮活動的狀態、活動起因、變化後總執行個體數等資訊。
介面說明
- 查詢時可以指定伸縮組ID來查詢該伸縮組下的所有伸縮活動。
- 查詢時可以通過伸縮活動的狀態來過濾查詢結果。
- 可以查詢30日內的伸縮活動。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
請求參數
|
名稱 |
類型 |
是否必選 |
樣本值 |
描述 |
| Action | String | 是 | DescribeScalingActivities | 系統規定參數。取值:DescribeScalingActivities。 |
| RegionId | String | 是 | cn-hangzhou | 伸縮活動所屬伸縮組的地區ID。 |
| PageNumber | Integer | 否 | 1 | 伸縮活動列表的頁碼,起始值:1。 預設值:1。 |
| PageSize | Integer | 否 | 10 | 分頁查詢時設定的每頁行數,最大值:50。 預設值:10。 |
| ScalingGroupId | String | 否 | asg-bp18p2yfxow2dloq**** | 伸縮組的ID。 說明 調用該API時, ScalingGroupId和ScalingActivityId.N參數必須二選一進行配置,如果兩個參數同時都不配置,則會報錯。 |
| StatusCode | String | 否 | Successful | 伸縮活動的狀態。取值範圍:
|
| ScalingActivityId.N | String | 否 | asa-bp161xudmuxdzofe**** | 待查詢伸縮活動的ID。 說明 調用該API時, ScalingGroupId和ScalingActivityId.N參數必須二選一進行配置,如果兩個參數同時都不配置,則會報錯。 |
返回資料
名稱 |
類型 |
樣本值 |
描述 |
| RequestId | String | CC107349-57B7-4405-B1BF-9BF5AF7F**** | 請求ID。 |
| PageNumber | Integer | 1 | 當前頁碼。 |
| PageSize | Integer | 10 | 每頁行數。 |
| TotalCount | Integer | 1 | 伸縮活動總數。 |
| ScalingActivities | Array of ScalingActivity | 伸縮活動資訊組成的集合。 |
|
| ScalingActivity | |||
| Progress | Integer | 100 | 伸縮活動的運行進度。 |
| ScalingInstanceNumber | Integer | 1 |
|
| AttachedCapacity | String | 0 | 執行完伸縮活動後,伸縮組中使用者手動添加的執行個體的總數。 |
| TotalCapacity | String | 2 | 執行完伸縮活動後,伸縮組中執行個體的總數。 |
| ScalingGroupId | String | asg-bp18p2yfxow2dloq**** | 伸縮組的ID。 |
| AutoCreatedCapacity | String | 2 | 執行完伸縮活動後,伸縮組中由伸縮組負責自動建立的執行個體的總數。 |
| EndTime | String | 2020-09-10T09:54Z | 伸縮活動的結束時間。 |
| StartTime | String | 2020-09-10T09:54Z | 伸縮活動的開始時間。 |
| Description | String | Add \"1\" ECS instance | 伸縮活動的描述資訊。 |
| StatusCode | String | Successful | 伸縮活動的狀態。可能值:
|
| Cause | String | A user requests to execute scaling rule \"asr-bp12tcnol686y1ik****\", changing the Total Capacity from \"1\" to \"2\". | 觸發伸縮活動的原因。 |
| ScalingActivityId | String | asa-bp161xudmuxdzofe**** | 伸縮活動的ID。 |
| StatusMessage | String | \"1\" ECS instances are added | 伸縮活動的狀態資訊。 |
| CreatedCapacity | Integer | 1 | 當前伸縮活動建立的執行個體數量。 |
| DestroyedCapacity | Integer | 1 | 當前伸縮活動釋放的執行個體數量。 |
| StartedCapacity | Integer | 1 | 當前伸縮活動從停機不收費狀態啟動的執行個體數量。 |
| StoppedCapacity | Integer | 1 | 當前伸縮活動進入停機不收費狀態的執行個體數量。 |
| CreatedInstances | Array of String | [ "i-abc1", "i-abc2" ] | 當前伸縮活動建立執行個體列表。 |
| DestroyedInstances | Array of String | [ "i-abc1", "i-abc2" ] | 當前伸縮活動釋放執行個體列表。 |
| StartedInstances | Array of String | [ "i-abc1", "i-abc2" ] | 當前伸縮活動啟動的停機不收費執行個體列表。 |
| StoppedInstances | Array of String | [ "i-abc1", "i-abc2" ] | 當前伸縮活動進入停機不收費狀態執行個體列表。 |
| ErrorCode | String | OperationDenied.NoStock | 伸縮活動失敗時的錯誤碼。 |
| ErrorMessage | String | The specified ECS resource is out of stock in this region. Please try again later. | 伸縮活動失敗時的錯誤資訊。 |
| Detail | String | "new ECS instances "i-j6c8ilerw, i-j6c8iler4mx" are created." | 伸縮活動詳細資料。 |
| TriggerSourceType | String | Api | 伸縮活動觸發源類型。可能值:
|
| TriggerSourceId | String | 2346366580***** | 伸縮活動觸發源ID。可能值:
|
| LifecycleHookContext | Object | 生命週期掛鈎上下文資訊。 |
|
| DisableLifecycleHook | Boolean | false | 伸縮活動是否禁用所有生命週期掛鈎。可能值:
|
| IgnoredLifecycleHookIds | Array of String | ash-bp14zolna43z266bq*** | 伸縮活動禁用的生命週期掛鈎ID列表。 |
| ActivityMetadata | String | {\"goatscaler.io/managed\":\"true\"} | 伸縮活動的中繼資料。 |
樣本
請求樣本
http(s)://ess.aliyuncs.com/?Action=DescribeScalingActivities
&RegionId=cn-hangzhou
&PageNumber=1
&PageSize=10
&ScalingGroupId=asg-bp18p2yfxow2dloq****
&StatusCode=Successful
&ScalingActivityId=["asa-bp161xudmuxdzofe****"]
&公用請求參數
正常返回樣本
XML格式
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeScalingActivitiesResponse>
<RequestId>CC107349-57B7-4405-B1BF-9BF5AF7F****</RequestId>
<PageNumber>1</PageNumber>
<PageSize>10</PageSize>
<TotalCount>1</TotalCount>
<ScalingActivities>
<Progress>100</Progress>
<ScalingInstanceNumber>1</ScalingInstanceNumber>
<AttachedCapacity>0</AttachedCapacity>
<TotalCapacity>2</TotalCapacity>
<ScalingGroupId>asg-bp18p2yfxow2dloq****</ScalingGroupId>
<AutoCreatedCapacity>2</AutoCreatedCapacity>
<EndTime>2020-09-10T09:54Z</EndTime>
<StartTime>2020-09-10T09:54Z</StartTime>
<Description>Add \"1\" ECS instance</Description>
<StatusCode>Successful</StatusCode>
<Cause>A user requests to execute scaling rule \"asr-bp12tcnol686y1ik****\", changing the Total Capacity from \"1\" to \"2\".</Cause>
<ScalingActivityId>asa-bp161xudmuxdzofe****</ScalingActivityId>
<StatusMessage>\"1\" ECS instances are added</StatusMessage>
<CreatedCapacity>1</CreatedCapacity>
<DestroyedCapacity>1</DestroyedCapacity>
<StartedCapacity>1</StartedCapacity>
<StoppedCapacity>1</StoppedCapacity>
<CreatedInstances>[ "i-abc1", "i-abc2" ]</CreatedInstances>
<DestroyedInstances>[ "i-abc1", "i-abc2" ]</DestroyedInstances>
<StartedInstances>[ "i-abc1", "i-abc2" ]</StartedInstances>
<StoppedInstances>[ "i-abc1", "i-abc2" ]</StoppedInstances>
<ErrorCode>OperationDenied.NoStock</ErrorCode>
<ErrorMessage>The specified ECS resource is out of stock in this region. Please try again later.</ErrorMessage>
<Detail>"new ECS instances "i-j6c8ilerw, i-j6c8iler4mx" are created."</Detail>
<TriggerSourceType>Api</TriggerSourceType>
<TriggerSourceId>2346366580*****</TriggerSourceId>
<LifecycleHookContext>
<DisableLifecycleHook>false</DisableLifecycleHook>
<IgnoredLifecycleHookIds>ash-bp14zolna43z266bq***</IgnoredLifecycleHookIds>
</LifecycleHookContext>
<ActivityMetadata>{\"goatscaler.io/managed\":\"true\"}</ActivityMetadata>
</ScalingActivities>
</DescribeScalingActivitiesResponse>
JSON格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "CC107349-57B7-4405-B1BF-9BF5AF7F****",
"PageNumber" : 1,
"PageSize" : 10,
"TotalCount" : 1,
"ScalingActivities" : [ {
"Progress" : 100,
"ScalingInstanceNumber" : 1,
"AttachedCapacity" : "0",
"TotalCapacity" : "2",
"ScalingGroupId" : "asg-bp18p2yfxow2dloq****",
"AutoCreatedCapacity" : "2",
"EndTime" : "2020-09-10T09:54Z",
"StartTime" : "2020-09-10T09:54Z",
"Description" : "Add \\\"1\\\" ECS instance",
"StatusCode" : "Successful",
"Cause" : "A user requests to execute scaling rule \\\"asr-bp12tcnol686y1ik****\\\", changing the Total Capacity from \\\"1\\\" to \\\"2\\\".",
"ScalingActivityId" : "asa-bp161xudmuxdzofe****",
"StatusMessage" : "\\\"1\\\" ECS instances are added",
"CreatedCapacity" : 1,
"DestroyedCapacity" : 1,
"StartedCapacity" : 1,
"StoppedCapacity" : 1,
"CreatedInstances" : [ "[ \"i-abc1\", \"i-abc2\" ]" ],
"DestroyedInstances" : [ "[ \"i-abc1\", \"i-abc2\" ]" ],
"StartedInstances" : [ "[ \"i-abc1\", \"i-abc2\" ]" ],
"StoppedInstances" : [ "[ \"i-abc1\", \"i-abc2\" ]" ],
"ErrorCode" : "OperationDenied.NoStock",
"ErrorMessage" : "The specified ECS resource is out of stock in this region. Please try again later.",
"Detail" : "\"new ECS instances \"i-j6c8ilerw, i-j6c8iler4mx\" are created.\"",
"TriggerSourceType" : "Api",
"TriggerSourceId" : "2346366580*****",
"LifecycleHookContext" : {
"DisableLifecycleHook" : false,
"IgnoredLifecycleHookIds" : [ "ash-bp14zolna43z266bq***" ]
},
"ActivityMetadata" : "{\\\"goatscaler.io/managed\\\":\\\"true\\\"}"
} ]
}
錯誤碼
訪問錯誤中心查看更多錯誤碼。