ECS实例支持设置的事件通知包括系统事件、生命周期状态变化、抢占式实例被释放等。

事件列表

ECS实例可以设置的事件通知包括:

系统事件

实例发生系统事件时,云服务器ECS会推送事件首次发布通知,事件每发生一次状态变更,均会发出事件状态变化通知。不同系统事件对应的事件通知名称请参见下文附录:实例系统事件对应的事件通知名称

因系统维护实例重启SystemMaintenance.Reboot)的事件为例,事件通知的JSON格式如下所示。

  • 首次发布系统事件,事件处于已计划Scheduled)状态。
    {
      "ver": "1.0",
      "id": "2256A988-0B26-4E2B-820A-8A********E5",
      "product": "ECS",
      "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
      "level": "CRITICAL",
      "name": "Instance:SystemMaintenance.Reboot:Scheduled",
      "userId": "169070********30",
      "eventTime": "20190409T121826.922+0800",
      "regionId": "cn-hangzhou",
      "content": {
        "eventId": "e-bp11trd********pqum2",
        "publishTime": "2019-04-09T04:18:26Z",
        "notBefore": "2019-04-12T01:01:01Z",      
        "instanceId": "i-bp1ecr********5go2go",   
        "eventType": "SystemMaintenance.Reboot",  
        "eventStatus": "Scheduled"
      }
    }
  • 假设您在系统事件计划执行时间(notBefore)前自行重启了实例,该系统事件被规避,并发布系统事件状态变更为已避免Avoided的通知。
    {
      "ver": "1.0",
      "id": "2256A988-0B26-4E2B-820A-8A********E5",
      "product": "ECS",
      "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
      "level": "CRITICAL",
      "name": "Instance:SystemMaintenance.Reboot:Scheduled",
      "userId": "169070********30",
      "eventTime": "20190410T160101.922+0800",
      "regionId": "cn-hangzhou",
      "content": {
        "eventId": "e-bp11trdr********qum2",
        "publishTime": "2019-04-09T04:18:26Z",
        "notBefore": "2019-04-12T01:01:01Z",
        "instanceId": "i-bp1ecr********5go2go",
        "eventType": "SystemMaintenance.Reboot",
        "eventStatus": "Avoided",
        "executeStartTime": "2019-04-10T08:01:01Z",  
        "executeFinishTime": "2019-04-10T08:01:01Z"  
      }
    }
content字段解释:
字段 说明 示例值
eventId 系统事件ID。 e-t4navn7********6x5no
publishTime 系统事件的发布时间。 2019-04-09T04:18:26Z
notBefore 系统事件计划执行时间。只有维护类系统事件才有值,异常系统事件不存在notBefore时间。 2019-04-12T01:01:01Z
instanceId 受影响的实例ID。 i-bp1ecr********5go2go
eventType 系统事件类型。取值请参见系统事件概述 SystemMaintenance.Reboot
eventStatus 系统事件状态。取值请参见系统事件概述 Avoided
executeStartTime 系统事件执行开始时间,采用UTC +0时区。 2019-04-10T08:01:01Z
executeFinishTime 系统事件执行结束时间,采用UTC +0时区。
说明执行中Executing)、已执行Executed)、已取消Canceled)和已避免Avoided)状态的系统事件才会返回executeStartTimeexecuteFinishTime属性。
2019-04-10T08:01:01Z

生命周期状态变化

实例的状态发生改变时,云服务器ECS会发出实例状态改变事件。有关实例状态变化的更多详情,请参见实例生命周期介绍

运行中Running)的状态变化为例,事件通知的格式如下所示。

{
  "ver": "1.0",
  "id": "2256A988-0B26-4E2B-820A-8A********E5",
  "product": "ECS",
  "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
  "level": "INFO",
  "name": "Instance:StateChange",
  "userId": "169070********30",
  "eventTime": "20190409T121826.922+0800",
  "regionId": "cn-hangzhou",
  "content": {
    "resourceId": "i-bp1ecr********5go2go",  
    "resourceType": "ALIYUN::ECS::Instance", 
    "state": "Running"                       
  }
}
content字段解释:
字段 说明 示例值
resourceId 实例ID。 i-bp1ecr********5go2go
resourceType 资源类型。取值范围:ALIYUN::ECS::Instance ALIYUN::ECS::Instance
state 实例状态。取值范围:
  • Pending:准备中。
  • Created:创建完成。该状态的事件通知仅在实例创建完成后发送一次。
  • Starting:启动中。
  • Running:运行中。
  • Stopping:停止中或重启中。
  • Stopped:已停止。
  • Deleted:已释放。
Running

抢占式实例被释放

抢占式实例会因为市场价格变化或资源库存调整等因素被自动释放。在实例被释放的前五分钟,云服务器ECS会发送抢占式实例中断事件。详情请参见抢占式实例概述

事件通知的JSON格式如下所示。

{
  "ver": "1.0",
  "id": "2256A988-0B26-4E2B-820A-8A********E5",
  "product": "ECS",
  "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
  "level": "INFO",
  "name": "Instance:PreemptibleInstanceInterruption",
  "userId": "169070********30",
  "eventTime": "20190409T121826.922+0800",
  "regionId": "cn-hangzhou",
  "content": {
    "instanceId": "i-bp1ecr********5go2go",  
    "action": "delete"                       
  }
}
content字段解释:
字段 说明 示例值
instanceId 抢占式实例ID。 i-bp1ecr********5go2go
action 抢占式实例的操作事件。取值范围:delete delete

专有宿主机上的ECS实例热迁移

调用ModifyInstanceDeployment能实现ECS实例在专有宿主机间的热迁移。热迁移为异步操作,且迁移期间ECS实例状态不会变化,通过设置事件通知(Instance:LiveMigrationAcrossDDH),您可以感知热迁移是否成功。

事件通知的JSON格式如下所示。

  • 开始热迁移:
    {
      "ver": "1.0",
      "id": "2256A988-0B26-4E2B-820A-8A0580D0B8E5",
      "product": "ECS",
      "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
      "level": "INFO",
      "instanceName": "instance-event-subscription",
      "name": "Instance:LiveMigrationAcrossDDH",
      "userId": "169070********30",
      "eventTime": "20180608T092537.922+0800",
      "regionId": "cn-hangzhou",
      "content": {
          "instanceId" : "i-bp1ecr********5go2go",
          "sourceDedicatedHostId" : "dh-2ze3lm********t8nr82",
          "destinationDedicatedHostId" : "dh-2ze3lm********t8nr83",
          "startTime" : "2018-06-08T01:25:37Z",
          "status" : "started"
      }
    }
  • 热迁移成功:
    {
      "ver": "1.0",
      "id": "2256A988-0B26-4E2B-820A-8A0580D0B8E5",
      "product": "ECS",
      "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
      "level": "INFO",
      "instanceName": "instance-event-subscription",
      "name": "Instance:LiveMigrationAcrossDDH",
      "userId": "169070********30",
      "eventTime": "20180608T092545.922+0800",
      "regionId": "cn-hangzhou",
      "content": {
          "instanceId" : "i-bp1ecr********5go2go",
          "sourceDedicatedHostId" : "dh-2ze3lm********t8nr82",
          "destinationDedicatedHostId" : "dh-2ze3lm********t8nr83",
          "startTime" : "2018-06-08T01:25:37Z",
          "endTime" : "2018-06-08T01:25:45Z",
          "status" : "accomplished"
      }
    }
  • 热迁移失败:
    {
      "ver": "1.0",
      "id": "2256A988-0B26-4E2B-820A-8A0580D0B8E5",
      "product": "ECS",
      "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
      "level": "INFO",
      "instanceName": "instance-event-subscription",
      "name": "Instance:LiveMigrationAcrossDDH",
      "userId": "169070********30",
      "eventTime": "20180608T092545.922+0800",
      "regionId": "cn-hangzhou",
      "content": {
          "instanceId" : "i-bp1ecr********5go2go",
          "sourceDedicatedHostId" : "dh-2ze3lm********t8nr82",
          "destinationDedicatedHostId" : "dh-2ze3lm********t8nr83",
          "startTime" : "2018-06-08T01:25:37Z",
          "endTime" : "2018-06-08T01:25:45Z",
          "status" : "failed"
      }
    }
content字段解释:
字段 说明 示例值
instanceId ECS实例ID。 i-bp1ecr********5go2go
sourceDedicatedHostId 源端专有宿主机ID。 dh-2ze3lm********t8nr82
destinationDedicatedHostId 目的端专有宿主机ID dh-2ze3lm********t8nr83
startTime 开始时间,采用UTC +0时区。 2018-06-08T01:25:37Z
endTime 结束时间,采用UTC +0时区。 2018-06-08T01:25:45Z
status 热迁移状态。取值范围:
  • started:迁移开始
  • failed:迁移失败
  • accomplished:迁移成功
accomplished

突发性能实例性能模式切换

突发性能实例在切换性能模式后,会发送事件通知,事件名为Instance:PerformanceModeChange

事件通知的JSON格式如下所示。

{
    "ver": "1.0",
    "id": "2256A988-0B26-4E2B-820A-8A0580D0B8E5",
    "product": "ECS",
    "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
    "level": "INFO",
    "name": "Instance:PerformanceModeChange",
    "userId": "169070********30",
    "eventTime": "20190409T121826.922+0800",
    "regionId": "cn-hangzhou",
    "content": {
        "instanceId" : "i-bp1ecr********5go2go",
        "creditSpecification" : "Unlimited",
        "operator" : "System"
    }
}
content字段解释:
字段 说明 示例值
instanceId ECS实例ID。 i-bp1ecr********5go2go
creditSpecification 切换后的性能模式。取值范围:
  • Standard:性能约束模式。
  • Unlimited:无性能约束模式。
Standard
operator 事件触发者。取值范围:
  • User:您通过控制台或API主动切换了实例性能模式。
  • System:因CPU积分消耗、停机不收费条件限制、账号欠费等原因导致的自动切换事件。更多详情,请参见切换性能模式
User

突发性能实例性能受限

由于CPU积分耗尽,实例性能被限制到基准性能以下。性能受限时,突发性能实例处于性能约束模式。事件名为Instance:BurstablePerformanceRestricted
说明 性能受限事件的粒度为小时,即事件区间开始时间与区间结束差一小时。仅代表突发性能实例在事件时段里发生过性能受限,不代表在时段内一直处于受限状态。如果实例长时间内一直处于性能受限状态,每小时均会产生一次事件。

事件通知的JSON格式如下所示。

{
    "ver": "1.0",
    "id": "2256A988-0B26-4E2B-820A-8A0580D0B8E5",
    "product": "ECS",
    "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
    "level": "INFO",
    "name": "Instance:BurstablePerformanceRestricted",
    "userId": "169070********30",
    "eventTime": "20190409T121826.922+0800",
    "regionId": "cn-hangzhou",
    "content": {
        "instanceId" : "i-bp1ecr********5go2go",
        "intervalStart" : "2019-11-11T11:00Z",
        "intervalEnd" : "2019-11-11T12:00Z"
    }
}
content字段解释:
字段 说明 示例值
instanceId ECS实例ID。 i-bp1ecr********5go2go
intervalStart 区间开始时间,采用UTC +0时区。 2019-11-11T11:00Z
intervalEnd 区间结束时间,采用UTC +0时区。 2019-11-11T12:00Z

附录:实例系统事件对应的事件通知名称

影响 事件类型及代码 事件通知名称及代码
实例重启 因系统维护实例重启(SystemMaintenance.Reboot)
  • 实例计划重启通知(系统维护):Instance:SystemMaintenance.Reboot:Scheduled
  • 实例计划重启执行中(系统维护):Instance:SystemMaintenance.Reboot:Executing
  • 实例计划重启已完成(系统维护):Instance:SystemMaintenance.Reboot:Executed
  • 实例计划重启规避(系统维护):Instance:SystemMaintenance.Reboot:Avoided
  • 实例计划重启取消(系统维护):Instance:SystemMaintenance.Reboot:Canceled
  • 实例计划重启失败(系统维护):Instance:SystemMaintenance.Reboot:Failed
实例异常重启 因系统错误实例重新启动(SystemFailure.Reboot)
  • 实例重启开始(系统错误):Instance:SystemFailure.Reboot:Executing
  • 实例重启结束(系统错误):Instance:SystemFailure.Reboot:Executed
实例异常重启 因实例错误实例重启(InstanceFailure.Reboot)
  • 实例重启开始(实例错误):Instance:InstanceFailure.Reboot:Executing
  • 实例重启结束(实例错误):Instance:InstanceFailure.Reboot:Executed
实例重新部署 因系统维护实例重新部署(SystemMaintenance.Redeploy)
  • 实例计划重新部署通知(系统维护):Instance:SystemMaintenance.Redeploy:Scheduled
  • 实例计划重新部署执行中(系统维护):Instance:SystemMaintenance.Redeploy:Executing
  • 实例计划重新部署已完成(系统维护):Instance:SystemMaintenance.Redeploy:Executed
  • 实例计划重新部署已规避(系统维护):Instance:SystemMaintenance.Redeploy:Avoided
  • 实例计划重新部署已取消(系统维护):Instance:SystemMaintenance.Redeploy:Canceled
实例重新部署 因系统错误实例重新部署(SystemFailure.Redeploy)
  • 实例计划重新部署通知(系统错误):Instance:SystemFailure.Redeploy:Scheduled
  • 实例重新部署执行中(系统错误):Instance:SystemFailure.Redeploy:Executing
  • 实例重新部署已完成(系统错误):Instance:SystemFailure.Redeploy:Executed
  • 实例重新部署已规避(系统错误):Instance:SystemFailure.Redeploy:Avoided
  • 实例重新部署已取消(系统错误):Instance:SystemFailure.Redeploy:Canceled
实例重启,隔离受损的本地盘 因系统维护计划重启并更换受损的本地盘(SystemMaintenance.RebootAndIsolateErrorDisk)
  • 因系统维护重启实例并隔离坏盘问询中:Instance:SystemMaintenance.RebootAndIsolateErrorDisk:Inquiring
  • 因系统维护重启实例并隔离坏盘执行中:Instance:SystemMaintenance.RebootAndIsolateErrorDisk:Executing
  • 因系统维护重启实例并隔离坏盘已完成:Instance:SystemMaintenance.RebootAndIsolateErrorDisk:Executed
  • 因系统维护重启实例并隔离坏盘已规避:Instance:SystemMaintenance.RebootAndIsolateErrorDisk:Avoided
  • 因系统维护重启实例并隔离坏盘已取消:Instance:SystemMaintenance.RebootAndIsolateErrorDisk:Canceled
实例重启,受损的本地盘恢复正常 因系统维护计划重启并重新初始化受损的本地盘(SystemMaintenance.RebootAndReInitErrorDisk)
  • 因系统维护重启实例并重新初始化坏盘问询中:Instance:SystemMaintenance.RebootAndReInitErrorDisk:Inquiring
  • 因系统维护重启实例并重新初始化坏盘执行中:Instance:SystemMaintenance.RebootAndReInitErrorDisk:Executing
  • 因系统维护重启实例并重新初始化坏盘已完成:Instance:SystemMaintenance.RebootAndReInitErrorDisk:Executed
  • 因系统维护重启实例并重新初始化坏盘已规避:Instance:SystemMaintenance.RebootAndReInitErrorDisk:Avoided
  • 因系统维护重启实例并重新初始化坏盘已取消:Instance:SystemMaintenance.RebootAndReInitErrorDisk:Canceled
实例释放 因实例创建失败而自动释放(SystemFailure.Delete)
  • 实例自动释放执行中(实例创建失败):Instance:SystemFailure.Delete:Executing
  • 实例自动释放已完成(实例创建失败):Instance:SystemFailure.Delete:Executed
  • 实例自动释放已规避(实例创建失败):Instance:SystemFailure.Delete:Avoided