If you want to monitor a large number of resources, you can use the alert template feature. This feature helps you save multiple alert rules on the metrics of various cloud services as a template. You can create or modify alert rules by using alert templates. This way, you do not need to configure each alert rule.

Background information

  • Alert templates must be used together with application groups. You can create an application group, and then create and apply an alert template to the application group. This simplifies the process to create and maintain alert rules. For information about how to create an application group, see Create an application group.
  • Before you create alert templates, take note of the following limits:
    • A maximum of 100 alert templates can be created for each Alibaba Cloud account.
    • A maximum of 30 metrics can be specified in each alert template.

Procedure

  1. Log on to the CloudMonitor console.
  2. In the left-side navigation pane, choose Alerts > Alert Templates.
  3. On the Alert Templates page, click Create Alert Template.
  4. In the Create/Modify Alert Template panel, specify a name for the template and select the cloud service that you want to monitor.
  5. Click Add Rule under the cloud service that you specify to configure an alert rule.
    CloudMonitor supports the following alert templates:
    • Metric template
      The following tables describe the parameters of a threshold-triggered alert rule.
      Parameter Description
      Rule Name The name of the threshold-triggered alert rule.
      Metric Type The metric type of the threshold-triggered alert rule. Valid values:
      • Single Metric: The alert rule applies to only one metric.
      • Multiple Metrics: The alert rule applies to multiple metrics.
      Metric Name The name of the metric that you want to monitor. For information about how to obtain the metrics for an Alibaba Cloud service, see Appendix 1: Metrics.
      Note This parameter is displayed only if you set the Metric Type parameter to Single Metric.
      Threshold and Alert Level The conditions, alert thresholds, and alert levels of the alert rule.

      You can configure alerts of different alert levels. You can specify an alert threshold for each alert level. If the value of a metric reaches an alert threshold, an alert of the corresponding level is triggered. The methods that are used by CloudMonitor to send alert notifications vary based on alert levels.

      Note This parameter is displayed only if you set the Metric Type parameter to Single Metric.
      Alert Level The alert level and the methods that are used to send alert notifications. Valid values:

      Info: Email + Webhook

      Note This parameter is displayed only if you set the Metric Type parameter to Multiple Metrics.
      Metric Type The method that you want to use to specify metrics and conditions. Valid values:
      • Standard creation: Select multiple metrics and specify conditions.
      • Expression creation: Enter an expression to specify multiple metrics and conditions.
      Note This parameter is displayed only if you set the Metric Type parameter to Multiple Metrics.
      Multi-metric Alert Condition The alert rule that is created for multiple metrics.
      Note This parameter is displayed only if you set the Metric Type parameter to Multiple Metrics and the second Metric Type parameter to Standard creation.
      Chart Preview The chart preview for multiple metrics.

      By default, Chart Preview is turned off.

      Note This parameter is displayed only if you set the Metric Type parameter to Multiple Metrics and the second Metric Type parameter to Standard creation.
      Relationship Between Metrics The relationship between multiple metrics. Valid values:
      • Generate alerts when all metrics meet the conditions (&&)
      • Generate alerts if one of the conditions is met (||)
      Note This parameter is displayed only if you set the Metric Type parameter to Multiple Metrics and the second Metric Type parameter to Standard creation.
      Multi-metric Alert Expression The expression that is used to specify multiple metrics and conditions.
      Note This parameter is displayed only if you set the Metric Type parameter to Multiple Metrics and the second Metric Type parameter to Expression creation.
      Select the number of times the threshold is reached before an alert is triggered The number of consecutive triggers. If the number of times that the metric values meet the trigger conditions reaches the value of this parameter, CloudMonitor sends alert notifications. Valid values: Continuous 1 Count Period, Continuous 3 Count Period, Continuous 5 Count Period, Continuous 10 Count Period, Continuous 15 Count Period, Continuous 30 Count Period, Continuous 60 Count Period, Continuous 70 Count Period, Continuous 90 Count Period, Continuous 120 Count Period, and Continuous 180 Count Period.
      Method to handle alerts when no monitoring data is found The method that is used to handle alerts when no monitoring data is found. Valid values:
      • Do not do anything (default value)
      • Send alert notifications
      • Treated as normal
    • Event template
      Event-triggered alert rules support only system events. The following table describes the parameters of an event-triggered alert rule.
      Parameter Description
      Rule Name The name of the event-triggered alert rule.
      Event Type The type of the event that triggers alerts. For more information about the types of the events that are supported by each Alibaba Cloud service, see Appendix 2: System events.
      Event Level The severity level of the event that triggers alerts. For more information about the severity levels of the events that are supported by each Alibaba Cloud service, see Appendix 2: System events.
      Event Name The name of the event that triggers alerts. For more information about the names of the events that are supported by each Alibaba Cloud service, see Appendix 2: System events.
      MNS Queue The Message Service (MNS) queue to which the event-triggered alert is delivered.
      Function Compute The Function Compute function to which the event-triggered alert is delivered.
      URL Callback The callback URL and request method. Enter a callback URL that can be accessed over the Internet. CloudMonitor sends a POST or GET request to push an alert notification to the specified callback URL. Only HTTP requests are supported. For information about how to configure callbacks, see Configure callbacks for system event-triggered alerts.
      Log Service The Log Service Logstore to which the event-triggered alert is delivered.
    • Group process template
      You can configure alert rules of the group process type only for ECS resources. The following table describes the parameters of an alert rule of the group process type.
      Parameter Description
      Process Name The name of the alert rule of the group process type.
      Match Rule The rule that is used to match processes. Valid values:
      • All: The alert rule applies to all instances in an application group. If one of the processes on an instance in the application group meets the conditions, an alert is triggered.
      • All Rules: If the processes on the instances in an application group meet all conditions, an alert is triggered.
      • Any Rule: If the processes on the instances in an application group meet one of the conditions, an alert is triggered.
      Match Express The dynamic rule that is used to match processes. The alert rule can be applied to all instances in the specified application group or to instances of a specific type.
      Note This parameter is required only if you set the Match Rule parameter to All rules or Any Rule.
      Number of Processes The number of processes.
    • Host availability template
      You can configure alert rules of the host availability type only for ECS resources. The following table describes the parameters of an alert rule of the host availability type.
      Parameter Description
      Task Name The name of the availability monitoring task.
      Monitoring Nodes The ID of the instance that you want to monitor. By default, All is specified. The value cannot be changed.
      Detection Type The method that you want to use to monitor the object. Valid values:
      • HTTP(S): If you select this option, enter the URL of the object that you want to monitor.
      • TELNET: If you select this option, enter the IP address of the object that you want to monitor.
      • PING: If you select this option, enter the IP address of the object that you want to monitor.
      Url/Host The URL or IP address of the object that you want to monitor. The type of the value of this parameter varies based on the value of the Detection Type parameter.
      Match Rule The method that you want to use to send a monitoring request. Valid values:
      • HEAD
      • GET
      • POST
      POST Content The content of POST requests for site monitoring.

      The content must be in the parameter1=value1&parameter2=value2 format and must be in English.

      This parameter is required only if you set the Detection Type parameter to HTTP(S) and the Request Method parameter to POST.

      Match Response Content The response content that you want to match and the method that you want to use to match the response content during site monitoring.
      If you specify response content, the site monitoring task checks whether the first 64 KB of the body of the HTTP response contains the response content that you specify. Valid values:
      • Generate Alerts If Response Contains
      • Generate Alerts If Response Does Not Contain
      Note This parameter is required only if you set the Detection Type parameter to HTTP(S).
      Status Code

      The range of the status codes that you want to match. If the status code that is returned meets the condition, CloudMonitor generates an alert.

      If the value of the Status Code parameter or the Response Time parameter reaches the corresponding threshold, an alert is triggered. CloudMonitor sends alert notifications to the alert contact group of a specified application group.

      Response Time

      The threshold of the response time. If the response time reaches the threshold specified by this parameter, CloudMonitor generates an alert.

      If the value of the Status Code parameter or the Response Time parameter reaches the corresponding threshold, an alert is triggered. CloudMonitor sends alert notifications to the alert contact group of a specified application group.

  6. Click OK.
  7. Click OK.
  8. In the Alert Template Created/Modified message, click Confirm.
    Note If you click Cancel, the alert template is created but not applied to application groups. For more information about how to apply an alert template to application groups, see Apply alert templates to application groups.
  9. In the Apply Templates to Groups dialog box, select one or more application groups and set the Mute For, Effective From, Alert Callback, and Priority parameters.
  10. Click Confirm.
  11. In the Apply Templates to Groups message, click Confirm.