To ensure the stable running of your business in Elastic Compute Service (ECS) and implement automated O&M, we recommend that you configure event notifications to monitor changes in the underlying environments. This topic describes how to create system event-triggered alert rules in the CloudMonitor console to automatically push event notifications. This can help you keep track of events.

Background information

CloudMonitor is a service that monitors Internet applications and Alibaba Cloud resources. It allows you to manage, monitor, and query system events that are generated for different Alibaba Cloud services to keep track of service usage and receive alert notifications in a timely manner.

You can use CloudMonitor to configure alert rules so that you are notified when system events occur. CloudMonitor supports different alert notification methods.
  • CloudMonitor can send alert notifications by using text messages, emails, or DingTalk chatbots.
  • CloudMonitor can push events to Message Service (MNS), Function Compute, Log Service, or the specified callback URL. This allows you to automate the exception handling process based on your business requirements.

Configure event notifications

Important If you want to apply alert rules to instances in a specified application group, make sure that the application group contains member instances. For more information, see Create an application group and Add resources to the application group.
  1. Log on to the CloudMonitor console.
  2. In the left-side navigation pane, choose Event Monitoring > System Event.
  3. On the System Event page, click the Event-triggered Alert Rules tab. On the Event Alert tab, click Create Alert Rule.
  4. In the Create / Modify Event Alert panel, set parameters to configure event notifications.
    The following table describes the parameters. For more information, see Create a system event-triggered alert rule.
    SectionParameterDescription
    Basic InfoAlert Rule NameEnter a name for the alert rule as instructed.
    Event AlertProduct TypeSelect ECS from the drop-down list.
    Event TypeSelect one or more event types to which you want to subscribe from the drop-down list. Valid values: Status Notification, Exception, and Maintenance.
    Event LevelSelect one or more event levels to which you want to subscribe from the drop-down list. Valid values: CRITICAL (CRITICAL ), WARN (WARN ), and INFO (INFO ).
    Event NameSelect one or more event names as needed from the drop-down list.
    Note We recommend that you do not select All Events. We recommend that you create different event-triggered alert rules based on the impacts of different events on your business.
    Resource RangeIf you select All Resources, CloudMonitor sends alert notifications for events of all resources based on your configurations.
    Notification MethodNotification MethodSet the notification method. When an event occurs, a corresponding event notification is sent by using text messages, emails, or DingTalk chatbots. Select notification methods as needed.
    Note Events whose level is INFO(INFO) occur frequently. We recommend that you do not set Event Level to INFO to prevent being disturbed by a large number of notifications.
    Notification message processing middlewareSet the notification message processing middleware. To automate event processing, you can select MNS Queue, Function Compute, URL Callback, and Log Service. If you select URL Callback, you can set Request Method to GET or POST.
    Mute forSelect the interval at which CloudMonitor resends alert notifications. After an alert is triggered, CloudMonitor resends alert notifications at the specified interval before the alert is cleared.
  5. Click OK.
    After the event notifications are configured, ECS sends notifications based on the specified notification methods. The following example shows a non-customized event notification in the JSON format. The notification is sent when the state of the ECS instance changes.
    {
        "eventTime": "20181226T220114.058+0800",
        "id": "9435EAD6-3CF6-4494-8F7A-3A********77",
        "level": "INFO",
        "name": "Instance:StateChange",
        "product": "ECS",
        "regionId": "cn-hangzhou",
        "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
        "userId": "169070********30",
        "ver": "1.0",
        "content": {
            "resourceId": "i-bp1ecr********5go2go",
            "resourceType": "ALIYUN::ECS::Instance",
            "state": "Stopping"
        }
    }

Test the alert rule

After you create a system event-triggered alert rule, you can test the alert rule. You can check whether alert notifications can be received or whether events can be pushed to MNS, Function Compute, Log Service, or the specified callback URL as configured.

  1. Log on to the CloudMonitor console.
  2. In the left-side navigation pane, choose Event Monitoring > System Event.
  3. Click the Event Alert tab.
  4. Find the alert rule that you want to test and click Test in the Actions column.
  5. In the Create Event Test panel, select the event to be tested.
  6. In the Content (JSON) section, edit the event content such as the instance ID.
  7. Click OK.
    CloudMonitor generates an event based on the event content to trigger the alert rule.

References

In CloudMonitor, you can associate subsequent processing methods (such as MNS queues) with alert rules to automatically handle the state change events of ECS instances. For more information, see Automate O&M based on status change events of ECS instances.