All Products
Search
Document Center

Elastic Compute Service:Use CloudMonitor to subscribe to ECS system event notifications

Last Updated:Mar 29, 2024

To ensure the stability of your business running on Elastic Compute Service (ECS) instances and implement automated O&M, we recommend that you subscribe to event notifications to monitor system changes. This topic describes how to subscribe to ECS system events on the CloudMonitor console.

Note

If your business requires fast response to events or may involve a large number of events, we recommend that you subscribe to ECS events through EventBridge. For more information, see Use EventBridge to quickly subscribe to ECS events.

Background information

CloudMonitor is a monitoring service that allows you to query, manage, and monitor the system events of Alibaba Cloud services in an integrated manner. For more information about CloudMonitor, see What is CloudMonitor?

You can use CloudMonitor to configure alert rules so that you are notified when system events occur. CloudMonitor supports the following notification methods:

  • Sends SMS, emails, or DingTalk messages.

  • Distributes the notifications to your Message Queue, Log Service, Function Compute, or Webhook services, so that you can handle the events in an automated manner.

Create a subscription policy

In this topic, a subscription policy is created for the Instance:StateChange system event.

  1. Log on to the CloudMonitor console.

  2. In the left-side navigation pane, choose Event Center > Event Subscription.

    Note

    You can also perform the following steps to create a subscription policy by using the System Event menu:

    1. In the left-side navigation pane, choose Event Center > System Event.

    2. In the Welcome to the New Event Center section, click Create Immediately to create a subscription policy.

  3. On the Subscription Policy tab, click Create Subscription Policy.

  4. On the Create a subscription policy page, configure the parameters.

    • Basic information: Enter a name for the subscription policy.

    • Alert Subscription:

      • Subscription Type: Select System events.

      • Subscription Scope:

        • Products: Select Elastic Compute Service (ECS) from the drop-down list.

        • Event Type: Select Abnormal.

        • Event name: Select Instance:StateChange.

        • Event Level: Select Notification (Info).

        • Application grouping, Event Content, and Event Resources: Leave these parameters empty, which indicates that notifications will be sent for the Instance:StateChange events that occur on all ECS instances under all application groups of the account.

          Note

          For a list of the system events supported by ECS, see System Event - Elastic Compute Service (ECS).

    • Combined noise reduction: Use the default settings.

    • Notification: Create a notification configuration. Use the default settings for Custom notification method.

      When you create a notification configuration, enter a notification configuration name, set the Notification settings parameter to Set the notification group directly, select an alert contact group from the Contact Group drop-down list, and then click OK.

      Note

      For more information about how to create a notification configuration, see the Create a notification configuration policy section of the "Manage notification configurations" topic.

      CloudMonitor automatically sends alert notifications based on the notification methods for the alert contacts in the specified alert contact group. For example, if you specify a mobile number and an email address for an alert contact and use the default notification method as the custom notification method, the alert contact receives only alert phone calls, text messages, and emails.

    • Push and Integration: Leave this section empty.

      Note

      For information about how to create a push channel, see Create a push channel.

Debug event subscription

After you subscribe to system event notifications, you can use the debugging feature to check whether notifications can be sent to Message Queue, Log Service, Function Compute, and Webhook services as expected.

  1. On the Subscription Policy tab, click Debug event subscription.

  2. In the Create event debugging panel, set Products to Elastic Compute Service (ECS) and Name to Instance:StateChange.

    CloudMonitor automatically generates the debugging content in the JSON format.

    Sample JSON content for the Instance:StateChange event

    {
        "product": "ECS",
        "resourceId": "acs:ecs:cn-hangzhou:1609982529920904:instance/<resource-id>",
        "level": "INFO",
        "instanceName": "instanceName",
        "regionId": "cn-hangzhou",
        "name": "Instance:StateChange",
        "content": {
            "resourceId": "i-b***vd2",
            "instanceName": "ehp***212",
            "instanceType": "ecs***rge",
            "state": "St***ng",
            "privateIpAddress": "10.***125",
            "resourceType": "ALI***nce"
        },
        "status": "Normal"
    }
  3. Click OK.

    An Operation successful message appears. CloudMonitor automatically sends a test alert notification to the alert contacts based on the notification methods specified in the subscription policy.

References

You can specify follow-up actions for event notifications, so as to handle status change events of ECS instances in an automated manner. For example, you can specify a Message Service (MNS) queue in the policy. For more information about the operations, see Automate O&M based on status change events of ECS instances.