Query and respond to ECS system events

更新时间:
复制 MD 格式

This topic describes how to query and respond to ECS system events using the ECS console and Alibaba Cloud CLI.

Background

In addition to querying and responding to system events using the ECS console, you can use Cloud Monitor to query system events for various products, including ECS, and configure notifications for the system events you want to monitor. For more information, see Query system events and Subscribe to ECS system event notifications.

Query and respond to system events

ECS console

You can query all system events for your instances in the Events page of the ECS console.

  1. Go to ECS console - Events.

  2. Query pending system events.

    A category with a number next to it indicates pending system events. The console recommends different response actions for different system events, such as renewing an instance for an expiration event or repairing a disk for a local disk damage event. You can follow the instructions in the console to perform the actions yourself, or wait for the system to execute them automatically. In the navigation pane on the left, select Instance Billing Events and filter the events by the pending status. The list shows that an instance has an "Instance Stopped Due to Expiration" event. The event is rated severe (marked in red) and is scheduled for execution in one day. In the Actions column, you can click Renew or Enable Auto-renewal to resolve the event.

  3. If an event requires you to reboot an instance or redeploy an instance, you must perform the operation from the console or by calling an API. Otherwise, the action will be ineffective.

    For more information about the API operations, see RebootInstance or RedeployInstance.

    Note

    Rebooting the instance from within its operating system, for example, using the reboot command, is ineffective.

Alibaba Cloud CLI

An Elastic Compute Service (ECS) instance is created. Alibaba CLI is installed on the instance. For information about how to install Alibaba Cloud CLI on different operating systems, see the following topics:

Note

In the following commands, replace <TheRegionId> with your actual region ID.

  1. Call the DescribeInstances operation to retrieve the instance IDs.

    aliyun ecs DescribeInstances --RegionId <TheRegionId> --output cols=InstanceId,InstanceName rows=Instances.Instance[]
  2. Call the DescribeInstanceHistoryEvents operation to query system events for a specific instance.

    • Query events in the Scheduled state:

      aliyun ecs DescribeInstanceHistoryEvents --RegionId <TheRegionId> --InstanceId <YourInstanceId> --InstanceEventCycleStatus.1 Scheduled --output cols=EventId,EventTypeName rows=InstanceSystemEventSet.InstanceSystemEventType[]
    • Query events in all states (Scheduled, Inquiring, Executing, Executed, Avoided, Canceled, and Failed):

      aliyun ecs DescribeInstanceHistoryEvents --RegionId <TheRegionId> --InstanceId <YourInstanceId> --InstanceEventCycleStatus.1 Scheduled --InstanceEventCycleStatus.2 Inquiring --InstanceEventCycleStatus.3 Executing --InstanceEventCycleStatus.4 Executed --InstanceEventCycleStatus.5 Canceled --InstanceEventCycleStatus.6 Avoided --InstanceEventCycleStatus.7 Failed --output cols=EventId,EventTypeName rows=InstanceSystemEventSet.InstanceSystemEventType[]
    • Query finished events (Executed, Avoided, Canceled, or Failed):

      aliyun ecs DescribeInstanceHistoryEvents --RegionId <TheRegionId> --InstanceId <YourInstanceId> --InstanceEventCycleStatus.1 Executed --InstanceEventCycleStatus.2 Avoided --InstanceEventCycleStatus.3 Canceled --InstanceEventCycleStatus.4 Failed --output cols=EventId,EventTypeName rows=InstanceSystemEventSet.InstanceSystemEventType[]
    • Query unfinished events (Scheduled, Inquiring, or Executing):

      aliyun ecs DescribeInstanceHistoryEvents --RegionId <TheRegionId> --InstanceId <YourInstanceId> --InstanceEventCycleStatus.1 Scheduled --InstanceEventCycleStatus.2 Inquiring --InstanceEventCycleStatus.3 Executing --output cols=EventId,EventTypeName rows=InstanceSystemEventSet.InstanceSystemEventType[]
  3. Choose a response action and call the corresponding API operation.

    Examples:

    • For a system event in the Inquiring state, call the AcceptInquiredSystemEvent operation to authorize Alibaba Cloud to execute the event, or ignore the notification to deny the authorization.

    • For a system event that requires you to redeploy an instance, you can either call the RedeployInstance operation to redeploy the instance yourself or wait for the system to do so automatically.

    • For a system event that reminds you that a subscription instance is about to expire, call the RenewInstance operation to renew the instance. Otherwise, the system automatically stops and releases the instance after it expires.

  4. If an event requires you to reboot an instance or redeploy an instance, you must perform the operation from the console or by calling an API. Otherwise, the action will be ineffective.

    For more information about the API operations, see RebootInstance or RedeployInstance.

    Note

    Rebooting the instance from within its operating system, for example, using the reboot command, is ineffective.

Configure ECS message notifications

To receive event notifications by internal message or email, or SMS message, configure message settings in Message Center to receive ECS-related messages, such as ECS expiration notifications, product operation notifications, and ECS fault notifications.

  1. Log in to the ECS console.

  2. In the upper-right corner of the page, hover over the notice icon and then click Message Settings.

  3. On the Common Settings page, find the message types you want to receive, and then select the check boxes in the Internal Message and Email and SMS columns.

    For example, to receive notifications for ECS system events, select the check boxes next to Product Operation Notifications and ECS Fault Notifications.

Related topics

  • Call the DescribeInstancesFullStatus operation to query the full status of one or more ECS instances. This information covers both the instance status (the instance's lifecycle state) and the system event status (the health status of a maintenance event).

  • Call the DescribeInstanceHistoryEvents operation to query the system events for a specific instance. You can specify parameters such as InstanceId and EventType. By default, this operation queries historical system events in an inactive state.

  • You can also call the ReportInstancesStatus operation to report exceptions for one or more ECS instances.