# RabbitMQ AMQP-0-9-1版本支持的监控指标
#### 功能说明
本章节定义了分布式消息服务RabbitMQ版上报云监控服务的监控指标的命名空间，监控指标列表和维度定义，用户可以通过云监控服务提供的管理控制台或[API接口](https://support.huaweicloud.com/api-ces/zh-cn_topic_0171212514.html)来检索RabbitMQ实例产生的监控指标和告警信息，也可以通过分布式消息服务RabbitMQ版控制台提供的"监控详情"页面来检索RabbitMQ实例产生的监控指标。
![](https://support.huaweicloud.com/usermanual-rabbitmq/public_sys-resources/note_3.0-zh-cn.png)
- 云监控服务最大支持4个层级维度，维度编号从0开始，编号3为最深层级。例如监控指标中的维度信息为"rabbitmq_instance_id,rabbitmq_vhost"时，表示对应的监控指标的维度存在层级关系，且"rabbitmq_instance_id"为0层，"rabbitmq_vhost"为1层。
- 根据Vhost名称的[约束限制](https://support.huaweicloud.com/usermanual-rabbitmq/rabbitmq_ug_0022.html#rabbitmq_ug_0022__section20136183845418)，如果Vhost名称中包含特殊字符，Vhost名称中的特殊字符在监控页面中会转换为"_"显示，例如Vhost1的名称为"1%"，Vhost2的名称为"1/"，两个Vhost在监控页面中都显示为"1_"，在监控页面Vhost名称相同的监控数据会重合。
 
#### 命名空间
SYS.DMS
#### 实例监控指标
表1实例支持的监控指标 
| 指标ID                      | 指标名称      | 指标含义                                                                                 | 取值范围         | 单位       | 进制         | 维度                     | 监控周期（原始指标） |
|:---|:---|:---|:---|:---|:---|:---|:---|
| connections               | 连接数        | 该指标用于统计RabbitMQ实例中的总连接数。                                                           | \>= 0       | Count    | 不涉及        | rabbitmq_instance_id  | 1分钟         |
| channels                  | 通道数       | 该指标用于统计RabbitMQ实例中的总通道数。                                                            | 0\~2000       | Count   | 不涉及      | rabbitmq_instance_id   | 1分钟       |
| queues                     | 队列数       | 该指标用于统计RabbitMQ实例中的总队列数。                                                            | 0\~1000     | Count     | 不涉及         | rabbitmq_instance_id  | 1分钟      |
| consumers                 | 消费者数     | 该指标用于统计RabbitMQ实例中的总消费者数。                                                            | \>= 0       | Count    | 不涉及        | rabbitmq_instance_id | 1分钟        |
| messages_ready             | 可消费消息数    | 该指标用于统计RabbitMQ实例中总可消费消息数量。                                                          | 0\~10000000 | Count    | 不涉及        | rabbitmq_instance_id  | 1分钟       |
| publish                    | 生产速率      | 统计RabbitMQ实例中实时消息生产速率。                                                              | \>= 0       | Count/s   | 不涉及         | rabbitmq_instance_id | 1分钟        |
| instance_bytes_in_rate    | 生产流量       | 统计RabbitMQ实例中每秒生产的字节数。                                                              | \>= 0         | Byte/s   | 1024(IEC) | rabbitmq_instance_id   | 1分钟        |
| instance_bytes_out_rate  | 消费流量     | 统计RabbitMQ实例中每秒消费的字节数。                                                             | \>= 0      | Byte/s     | 1024(IEC)    | rabbitmq_instance_id  | 1分钟        |
| deliver_get              | 消费速率      | 统计RabbitMQ实例中实时消息消费速率。                                                              | \>= 0        | Count/s | 不涉及       | rabbitmq_instance_id  | 1分钟        |
| instance_disk_usage         | 实例磁盘容量使用率  | 实例磁盘容量使用率。                                                                          | 0\~100         | %        | 不涉及        | rabbitmq_instance_id  | 1分钟       |
| instance_tps              | 实例每秒请求个数 | 统计RabbitMQ实例每秒处理的请求个数。                                                              | 0\~10000000  | Count     | 不涉及          | rabbitmq_instance_id    | 1分钟           |
| instance_connections_usage | 实例连接数使用率    | 该指标用于统计实例的总连接数占实例最大连接数的比率。 部分存量实例不支持此监控，请联系客服解决。 | 0\~100       | %         | 不涉及        | rabbitmq_instance_id  | 1分钟          |
   
#### Vhost监控指标
表2Vhost支持的监控指标 
| 指标ID                         | 指标名称    | 指标含义                | 取值范围    | 单位       | 进制        | 维度                                   | 监控周期（原始指标） |
|:---|:---|:---|:---|:---|:---|:---|:---|
| vhost_connections             | 连接数        | 统计该Vhost中的总连接数。     | \>= 0 | Count     | 不涉及       | rabbitmq_instance_id,rabbitmq_vhost  | 1分钟         |
| vhost_channels                | 通道数        | 统计该Vhost中的总通道数。     | \>= 0   | Count     | 不涉及       | rabbitmq_instance_id,rabbitmq_vhost    | 1分钟          |
| vhost_queues                    | 队列数      | 统计该Vhost中的总队列数。     | \>= 0  | Count     | 不涉及       | rabbitmq_instance_id,rabbitmq_vhost   | 1分钟        |
| vhost_consumers                | 消费者数      | 统计该Vhost中的总消费者数。      | \>= 0 | Count    | 不涉及        | rabbitmq_instance_id,rabbitmq_vhost  | 1分钟       |
| vhost_messages_ready             | 可消费消息数    | 统计该Vhost中总可消费消息数量。  | \>= 0   | Count   | 不涉及       | rabbitmq_instance_id,rabbitmq_vhost   | 1分钟         |
| vhost_messages_publish_rate     | 生产速率      | 统计该Vhost中实时消息生产速率。    | \>= 0    | Count/s    | 不涉及      | rabbitmq_instance_id,rabbitmq_vhost | 1分钟        |
| vhost_messages_deliver_get_rate | 消费速率     | 统计该Vhost中实时消息消费速率。  | \>= 0  | Count/s | 不涉及       | rabbitmq_instance_id,rabbitmq_vhost   | 1分钟          |
| vhost_bytes_in_rate             | 生产流量       | 统计该Vhost中每秒生产的字节数。    | \>= 0    | Byte/s   | 1024(IEC)  | rabbitmq_instance_id,rabbitmq_vhost | 1分钟           |
| vhost_bytes_out_rate           | 消费流量     | 统计该Vhost中每秒消费的字节数。 | \>= 0   | Byte/s    | 1024(IEC) | rabbitmq_instance_id,rabbitmq_vhost    | 1分钟         |
| vhost_tps                       | vhost请求速率 | 统计当前Vhost每秒处理的请求个数。  | \>= 0 | Count      | 不涉及      | rabbitmq_instance_id,rabbitmq_vhost    | 1分钟        |
   
#### Exchange监控指标
表3Exchange支持的监控指标 
| 指标ID                            | 指标名称 | 指标含义                   | 取值范围     | 单位       | 进制     | 维度                                                         | 监控周期（原始指标） |
|:---|:---|:---|:---|:---|:---|:---|:---|
| exchange_messages_publish_rate | 生产速率 | 统计该Exchange中实时消息生产速率。 | \>= 0  | Count/s | 不涉及       | rabbitmq_instance_id,rabbitmq_vhost,rabbitmq_vhost_exchange | 1分钟         |
| exchange_bytes_in_rate         | 生产流量  | 统计该Exchange中每秒生产的字节数。  | \>= 0 | Byte/s   | 1024(IEC) | rabbitmq_instance_id,rabbitmq_vhost,rabbitmq_vhost_exchange | 1分钟          |
   
#### Queue监控指标
表4Queue支持的监控指标 
| 指标ID                         | 指标名称      | 指标含义                | 取值范围  | 单位      | 进制        | 维度                                                      | 监控周期（原始指标） |
|:---|:---|:---|:---|:---|:---|:---|:---|
| queue_messages_ready          | 队列可消费消息数 | 该指标用于统计队列中可消费的消息数。   | \>= 0   | Count    | 不涉及      | rabbitmq_instance_id,rabbitmq_vhost,rabbitmq_vhost_queue  | 1分钟       |
| queue_consumers              | 消费者数量    | 该指标用于统计订阅该队列的消费者个数。  | \>= 0  | Count    | 不涉及       | rabbitmq_instance_id,rabbitmq_vhost,rabbitmq_vhost_queue | 1分钟         |
| queue_messages_publish_rate  | 生产速率       | 该指标用于统计该队列每秒的消息流入数。   | \>= 0  | Count/s | 不涉及      | rabbitmq_instance_id,rabbitmq_vhost,rabbitmq_vhost_queue | 1分钟       |
| queue_messages_deliver_get_rate | 消费速率        | 该指标用于统计该队列每秒的消息流出数。  | \>= 0   | Count/s    | 不涉及        | rabbitmq_instance_id,rabbitmq_vhost,rabbitmq_vhost_queue   | 1分钟         |
| queue_bytes_in_rate           | 生产流量      | 该指标用于统计该队列实时消息生产速率。 | \>= 0 | Byte/s    | 1024(IEC)  | rabbitmq_instance_id,rabbitmq_vhost,rabbitmq_vhost_queue | 1分钟         |
| queue_bytes_out_rate           | 消费流量       | 该指标用于统计该队列实时消息消费速率。   | \>= 0   | Byte/s   | 1024(IEC) | rabbitmq_instance_id,rabbitmq_vhost,rabbitmq_vhost_queue  | 1分钟        |
   
对于有多层测量维度的测量对象，使用接口查询监控指标时，需要代入具体指标的维度层级关系。
例如，需要查询RabbitMQ Vhost中的总连接数（vhost_connections），该指标的维度信息为"rabbitmq_instance_id,rabbitmq_vhost"，表示rabbitmq_instance_id为0层，rabbitmq_vhost为1层。
- 通过API查询单个监控指标时，rabbitmq_vhost的维度信息代入样例如下：
  ```
  dim.0=rabbitmq_instance_id,0186688d-fxxx-497bfdda6c8e&dim.1=rabbitmq_vhost,default
  ```
  其中，0186688d-fxxx-497bfdda6c8e和default分别为rabbitmq_instance_id和rabbitmq_vhost的维度值，具体获取方法请参见[维度]表格中的获取指导。
  
- 通过API批量查询监控指标时，rabbitmq_vhost的维度信息代入样例如下：
  ```
  "dimensions": [ 
                   { 
                       "name": "rabbitmq_instance_id", 
                       "value": "0186688d-fxxx-497bfdda6c8e"    
                   }, 
                   { 
                       "name": "rabbitmq_vhost", 
                       "value": "default" 
                   } 
               ]
  ```
  其中，0186688d-fxxx-497bfdda6c8e和default分别为rabbitmq_instance_id和rabbitmq_vhost的维度值，具体获取方法请参见[维度]表格中的获取指导。
  
 #### 维度
| Key                     | Value                                                                                                                                                                                     |
|:---|:---|
| rabbitmq_instance_id    | RabbitMQ实例ID，例如：0186688d-fxxx-497bfdda6c8e。 该取值的获取方式为：调用[查询所有实例列表](https://support.huaweicloud.com/api-rabbitmq/ListInstances.html)，从接口返回的响应参数中提取。     |
| rabbitmq_vhost            | RabbitMQ实例Vhost名称，例如：default。 该取值的获取方式为：调用[查询实例在CES的监控层级关系](https://support.huaweicloud.com/api-rabbitmq/ShowCesHierarchy.html)API，从接口返回的响应参数中提取。      |
| rabbitmq_vhost_exchange | RabbitMQ实例Exchange名称，例如：Exchange-01。 该取值的获取方式为：调用[查询实例在CES的监控层级关系](https://support.huaweicloud.com/api-rabbitmq/ShowCesHierarchy.html)API，从接口返回的响应参数中提取。 |
| rabbitmq_vhost_queue     | RabbitMQ实例Queue名称，例如：Queue-01。 该取值的获取方式为：调用[查询实例在CES的监控层级关系](https://support.huaweicloud.com/api-rabbitmq/ShowCesHierarchy.html)API，从接口返回的响应参数中提取。        |
   
