This topic describes how to create an event-triggered rule so that you can receive alert notifications when system exceptions occur in Alibaba Cloud services and handle the exceptions in a timely manner.

Prerequisites

An Alibaba Cloud account is created. You can create an Alibaba Cloud account on the account registration page.

An alert contact and an alert group are created. When you create an alert rule, you can select the alert group to receive alert notifications. For more information about how to create an alert contact and an alert group, see Create an application group and Add resources to an application group.

A callback URL that can be accessed over the Internet is prepared if you need to use alert callbacks. The URL callback feature is enabled as an alert notification method in your existing O&M or notification system. A queue or a function is created if you need to use Message Service (MNS) or Function Compute to report alerts about system events.

Background information

CloudMonitor can notify you of system exceptions. You can automate the handling process by using alert notifications. CloudMonitor supports the following notification methods for events:
  • Sends alert notifications to you by using emails, phone calls, text messages, or DingTalk chatbots.
  • Pushes alert notifications to your MNS queue, Function Compute, Log Service, or the specified callback URL. Then, you can automate the handling process based on your scenario.

Create an event-triggered alert rule

Events are classified into system events and custom events. The alert rule and notification method vary with the event type.

  1. Log on to the CloudMonitor console.
  2. In the left-side navigation pane, choose Alarms > Alarm Rules. The Threshold Value Alarm tab of the Alarm Rules page appears by default.
  3. Click the Event Alarm tab. On the Event Alarm tab, click Create Event Alert.
  4. In the Basic Information section of the Create / Modify Event Alert right-side pane, specify the alert rule name.
  5. Set the parameters in the Event alert section.
    • If you set the event type to System Event:
      • Product Type, Event Level, and Event Name: Set these parameters as needed.
      • Resource Range: If you select All Resources, CloudMonitor sends alert notifications for resource-related events. If you select Application Groups, CloudMonitor sends alert notifications for events related to the resources in the specified application group.
    • If you set the event type to Custom Event, set the Application Group, Event Name, and Rule Description parameters as needed.
  6. Set the parameters in the Alarm Type section.
    System events support alert notifications, MNS queues, Function Compute, and alert callback as the notification method. Custom events support alert notifications and alert callback as the notification method.
  7. Click OK.

Test an event-triggered alert rule

After you create an event-triggered alert rule, you can use simulated system events to test the alert rule. In this way, you can check whether the MNS queue configured in the alert rule can receive events and whether the function in Function Compute can be triggered.

  1. Log on to the CloudMonitor console.
  2. In the left-side navigation pane, choose Alarms > Alarm Rules. The Threshold Value Alarm tab of the Alarm Rules page appears by default.
  3. Click the Event Alarm tab. The Event Alarm tab displays an alert rule list.
  4. Find the target alert rule and click test in the Actions column.
  5. In the Create event test right-side pane, select the event to be tested. In the Content(JSON) section, modify the event content, such as the instance ID, as needed.
  6. Click OK.
    CloudMonitor generates the selected event. Check whether an alert notification is sent, an event message is sent to the MNS queue, the function in Function Compute is triggered, or an alert is sent to the callback URL as configured in the alert rule.