Cloud Monitor provides features such as monitoring data collection, visualization, and real-time monitoring and alerting. Cloud Monitor determines whether the resource usage exceeds the specified threshold based on the configured alert rule. If the specified threshold is exceeded, Cloud Monitor sends alert notifications to specified contacts by using emails or DingTalk chatbot. The monitoring and alerting feature allows you to handle exceptions at the earliest opportunity. This topic describes how to create alert rules for resources of Message Queue for Apache RocketMQ.

Note The monitoring and alerting feature does not support accumulated messages that are sent and received by using the HTTP protocol.

Step 1: Create a service linked role

When you use the monitoring and alerting feature provided by Cloud Monitor for the first time, Message Queue for Apache RocketMQ automatically creates a service linked role named AliyunServiceRoleForOns for you to access cloud resources of Cloud Monitor. For more information about the service linked role for Message Queue for Apache RocketMQ, see Service linked role for.

  1. Log on to the Message Queue for Apache RocketMQ console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select a region, such as China (Hangzhou).
  4. On the Instances page, find the instance and click Details in the Actions column.
  5. In the left-side navigation pane, click Monitoring and Alerting.
  6. In the Service Linked Role dialog box, click OK.
    SLR

Step 2: View monitoring reports

  1. Log on to the Message Queue for Apache RocketMQ console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select a region, such as China (Hangzhou).
  4. On the Instances page, find the instance and click Details in the Actions column.
  5. In the left-side navigation pane, click Monitoring and Alerting, and select the resource whose monitoring data you want to view.
    cloud_monitor_list
    • To view the monitoring report of an instance, choose Instance > Cloud Monitor. The following figure shows an example.cloud_monitor_instance
      Note

      MessageRetentionPeriod

      This metric indicates the maximum retention period of all messages in the cluster. This metric is available only for Platinum Edition instances. To ensure continuous availability of the instance, Message Queue for Apache RocketMQ deletes the messages in the first-in-first-out (FIFO) order if the used space has reached the capacity of the Platinum Edition instance.

      You can upgrade or downgrade the capacity of your Platinum Edition instances in the cluster based on the value of this metric.

      The horizontal axis represents the point in time, and the vertical axis represents the message retention period. For example, assume that the point in time on the horizontal axis is 21:00, and the corresponding value on the vertical axis is 10. The message retention period of the Platinum Edition instance is 10 hours at 21:00. If you want to retain these messages for a longer period, you must upgrade the capacity of the disk.

      For more information about pricing of Platinum Edition instances, see Billing overview.

    • To view the monitoring report of a topic, choose Topic > Cloud Monitor. The following figure shows an example.cloud_mointor_topic
    • To view the monitoring report of a group ID, choose Group > Cloud Monitor. The following figure shows an example.cloud_mointor_group
      Note

      ConsumerLag(unit)

      This metric indicates the number of accumulated messages within the group ID. For more information about message accumulation, see Terms.

You can view the data of the last 1 hour, 3 hours, 6 hours, 12 hours, 1 day, 3 days, 7 days, or 14 days. You can also click the rightmost time picker to customize a time range.

If you want to customize a time range, you can view data of up to the last 31 days. Data generated prior to the last 31 days is not retained. If the end time in the time picker is the current system time, the earliest start time can be 31 days prior to the current system time. If the end time is not the current system time, you can view data of up to 7 consecutive days within the last 31 days.

Note The data aggregation cycle of the metrics is 1 minute.

Step 3: Configure alert rules

  1. Log on to the Message Queue for Apache RocketMQ console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select a region, such as China (Hangzhou).
  4. On the Instances page, find the instance and click Details in the Actions column.
  5. In the left-side navigation pane, click Monitoring and Alerting.
  6. In the upper-left corner of the Monitoring and Alerting page, click Configure Alert Rule.
  7. On the Create Alert Rule page, configure the alert rule and notification method. For more information, see Create a threshold-triggered alert rule.
    set_mointor_rule

    The following table lists the metrics of Message Queue for Apache RocketMQ.

    Metric Unit Metric Dimensions Statistics
    ConsumerLag count ConsumerLag userId, instanceId, and groupId Sum
    ConsumerLagPerGidTopic count ConsumerLagPerGidTopic userId, instanceId, groupId, and topic Sum
    MessageRetentionPeriod hour MessageRetentionPeriod userId and instanceId Minimum
    ReceiveMessageCountPerGid count/min ReceiveMessageCountPerGid userId, instanceId, and groupId Sum
    ReceiveMessageCountPerGidTopic count/min ReceiveMessageCountPerGidTopic userId, instanceId, topic, and groupId Sum
    Number of messages received by an instance per minute. count/min ReceiveMessageCountPerInstance userId and instanceId Sum
    ReceiveMessageCountPerTopic count/min ReceiveMessageCountPerTopic userId, instanceId, and topic Sum
    SendDLQMessageCountPerGid count/min SendDLQMessageCountPerGid userId, instanceId, and groupId Sum
    SendDLQMessageCountPerGidTopic count/min SendDLQMessageCountPerGidTopic userId, instanceId, groupId, and topic Sum
    SendMessageCountPerGid count/min SendMessageCountPerGid userId, instanceId, and groupId Sum
    SendMessageCountPerGidTopic count/min SendMessageCountPerGidTopic userId, instanceId, topic, and groupId Sum
    SendMessageCountPerInstance count/min SendMessageCountPerInstance userId and instanceId Sum
    SendMessageCountPerTopic count/min SendMessageCountPerTopic userId, instanceId, and topic Sum
    Click Alert Rules in the Actions column of the instance to view the information of the alert rule that you have created.