The monitoring and alerting feature of Cloud Monitor can be used to remind you to handle problems or upgrade specifications promptly. Cloud Monitor determines whether the resource usage exceeds the configured threshold based on the alert rule you configured. If the configured threshold is exceeded, Cloud Monitor sends notifications to related contacts by using SMS messages, emails, TradeManager, or DingTalk chatbot.

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 the service linked role 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 top navigation bar, select the target region.
  3. On the Instances page, find the target instance and click Details in the Actions column.
  4. In the left-side navigation pane, click Monitoring and Alerts (Recommended).
  5. In the Service Linked Role dialog box, click OK.
    SLR

Step 2: View monitoring report information

  1. Log on to the Message Queue for Apache RocketMQ console.
  2. In the top navigation bar, select the target region.
  3. On the Instances page, find the target instance and click Details in the Actions column.
  4. In the left-side navigation pane, click Monitoring and Alerts (Recommended), and select the resource whose monitoring data you want to view.
    cloud_monitor
    • To view the alert information of an instance, choose Instance > Monitoring Statistics, as shown in the following figure.instance_cloud_monitor
      Note

      MessageRetentionPeriod

      This metric indicates the maximum retention period of all messages in the current cluster. It is available only in Enterprise Platinum Edition instances. To ensure the continuous availability of Message Queue for Apache RocketMQ, when the disk space occupied has reached the disk capacity specification of your Enterprise Platinum Edition instance, Message Queue for Apache RocketMQ deletes the messages with the earliest storage time in the first-in-first-out (FIFO) order.

      You can use this metric to measure the capacity of your Enterprise Platinum Edition instance, and the results are to be taken into account of when you upgrade or downgrade the capacity of your Enterprise Platinum Edition instance.

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

    • To view the alert information under a topic, choose Topic > Monitoring Statistics, as shown in the following figure.topic_cloud_monitor
    • To view the alert information under a group ID, choose Group > Monitoring Statistics, as shown in the following figure.gid_cloud_monitor
      Note

      ConsumerLag(unit)

      This metric indicates the number of accumulated messages under the group ID. For more information, 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, or 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. That is, 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 date. 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: Set alert rules

  1. Log on to the Message Queue for Apache RocketMQ console.
  2. In the top navigation bar, select the target region.
  3. On the Instances page, find the target instance and click Details in the Actions column.
  4. In the left-side navigation pane, click Monitoring and Alerts (Recommended), and select the resource whose monitoring data you want to view.
  5. Find the target resource and click Set Alerts in the Actions column.
  6. On the Create Alarm Rule page, set the alert rule and notification method. For more information, see Create a threshold-triggered alert rule.
    Set alert rules
    Note To receive SMS notifications, log on to the Cloud Monitor console. On the Overview page, click Purchase SMS to purchase the SMS service.

    The following table lists the Message Queue for Apache RocketMQ monitoring items.

    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
    On the Alert Rule Configuration tab of the corresponding resource, you can view the created alert rule information.