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

For more information about CloudMonitor, see Cloud Service Monitoring.

Step 1: Create a service-linked role

The first time you use the monitoring and alerting feature that is provided by CloudMonitor, Message Queue for Apache RocketMQ automatically creates the AliyunServiceRoleForOns service-linked role to allow you to access cloud resources of CloudMonitor. Message Queue for Apache RocketMQ For more information about the service-linked role, see Service-linked roles.

  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 that you want to manage and click Details in the Actions column.
  5. In the left-side navigation pane, click Monitoring and Alerting.
  6. In the Service Linked Role message, 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 that you want to manage and click Details in the Actions column.
  5. In the left-side navigation pane, click Monitoring and Alerting. On the page that appears, 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. Instance monitoring
    • 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, choose Group > Cloud Monitor. The following figure shows an example. cloud_mointor_group
      Note

      ConsumerLag(unit)

      This metric indicates the number of accumulated messages in the specified group. 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 time picker on the right to customize a time range.

If you customize a time range, you can view data of the last 31 days. The system does not retain the data that is generated before this 31-day period. If the end time in the time picker is the same as the current system time, the earliest start time can be 31 days prior to the current system time. If the end time is different from the current system time, you can view data of a 7-day period within the last 31 days.

Note The data of each metric is aggregated at an interval of 1 minute.

Step 3: Configure an alert rule

  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 that you want to manage 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 specify the notification method. For more information, see Create an alert rule.
    set_mointor_rule

    The following table describes the metrics that are available in Message Queue for Apache RocketMQ.

    Note For more information about the Ready messages and Ready message queue time metrics, see Concepts.
    Metric Unit MetricName Dimensions Statistics
    ConsumerLag Count ConsumerLag userId, instanceId, and groupId Sum
    ConsumerLagPerGidTopic Count ConsumerLagPerGidTopic userId, instanceId, groupId, and topic Sum
    InstanceApiCallTps Count/s InstanceApiCallTps userId and instanceId Sum
    MessageRetentionPeriod Hour MessageRetentionPeriod userId and instanceId Minimum
    ReadyMessageQueueTime Millisecond ReadyMessageQueueTime userId, instanceId, and groupId Maximum
    ReadyMessageQueueTimePerGidTopic Millisecond ReadyMessageQueueTimePerGidTopic userId, instanceId, groupId, and topic Maximum
    ReadyMessages Count ReadyMessages userId, instanceId, and groupId Sum
    ReadyMessagesPerGidTopic Count ReadyMessagesPerGidTopic userId, instanceId, groupId, and topic Sum
    ReceiveMessageCountPerGid Count/min ReceiveMessageCountPerGid userId, instanceId, and groupId Sum
    ReceiveMessageCountPerGidTopic Count/min ReceiveMessageCountPerGidTopic userId, instanceId, topic, and groupId Sum
    ReceiveMessageCountPerInstance 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
    Find the resource for which you created the alert rule, and click Alert Rules in the Actions column to view the information about the alert rule.