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 SMS messages, emails, TradeManager, 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.
- Log on to the Message Queue for Apache RocketMQ console.
- In the left-side navigation pane, click Instances.
- In the top navigation bar, select a region, for example, China (Hangzhou).
- On the Instances page, find the instance and click Details in the Actions column.
- In the left-side navigation pane, click Monitoring and Alerting.
- In the Service Linked Role dialog box, click OK.
Step 2: View monitoring reports
- Log on to the Message Queue for Apache RocketMQ console.
- In the left-side navigation pane, click Instances.
- In the top navigation bar, select a region, for example, China (Hangzhou).
- On the Instances page, find the instance and click Details in the Actions column.
- In the left-side navigation pane, click Monitoring and Alerting, and select the resource whose monitoring data you want to view.

- To view the monitoring report of an instance, choose . The following figure shows an example.

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 . The following figure shows an example.

- To view the monitoring report of a group ID, choose . The following figure shows an example.

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
- Log on to the Message Queue for Apache RocketMQ console.
- In the left-side navigation pane, click Instances.
- In the top navigation bar, select a region, for example, China (Hangzhou).
- On the Instances page, find the instance and click Details in the Actions column.
- In the left-side navigation pane, click Monitoring and Alerting.
- In the upper-left corner of the Monitoring and Alerting page, click Configure Alert Rule.
- On the Create Alert Rule page, configure the alert rule and notification method. For more information, see
Create a threshold-triggered alert rule.

Note To receive SMS messages, log on to the
Cloud Monitor console. On the
Overview page, click
Purchase SMS to purchase the SMS service.
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.