跳转至

采集器「阿里云-RabbitMQ」配置手册

阅读本文前,请先阅读:

使用本采集器前,必须安装「观测云集成 Core 核心包」及其配套的第三方依赖包

1. 配置结构

本采集器配置结构如下:

字段 类型 是否必须 说明
regions list 必须 所需采集的地域列表
regions[#] str 必须 地域 ID。如:'cn-hangzhou'
总表见附录

2. 配置示例

指定地域

采集杭州地域的数据

Python
1
2
3
collector_configs = {
    'regions': [ 'cn-hangzhou']
}

配置过滤器(可选项)

本采集器脚本支持用户自定义过滤器,让用户通过对象属性筛选出目标资源。过滤器函数返回值为 True|False - True:目标资源需要被采集。 - False 目标资源不需要被采集

支持筛选的对象属性:

属性 描述
Status 实例状态
SupportEIP 是否支持EIP
PrivateEndpoint 实例的VPC接入点
StorageSize 磁盘容量,单位:GB
InstanceId 实例 ID
InstanceType 实例类型
PublicEndpoint 实例的公网接入点
MaxVhost 实例的Vhost的数量上限
AutoRenewInstance 是否自动更新实例
InstanceName 实例名称
MaxQueue 实例的Queue的数量上限
OrderType 订单类型
Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# 示例:开启过滤器,根据对象的 InstanceId 和 OrderType 属性过滤,配置格式如下:

def filter_cluster(cluster):
    instance_id = cluster['InstanceId']
    order_type = cluster['OrderType']
    if instance_id in ['xxx'] and order_type in ['PRE_PAID']:
        return True
    return False

###### Do not modify the following contents #####
from guance_integration__runner import Runner
import guance_aliyun_rabbitmq__main as main

def run():
    Runner(main.DataCollector(account, collector_configs, filters=[filter_cluster])).run()

3. 数据上报格式

数据正常同步后,可以在观测云的「基础设施-自定义对象」中查看数据。

上报的数据示例如下:

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
  "measurement": "aliyun_rabbitmq",
  "tags": {
    "AutoRenewInstance": "False",
    "InstanceId": "rabbitmq-xxxx",
    "InstanceName": "rabbitmq-xxxx",
    "InstanceType": "SERVERLESS",
    "MaxEipTps": "-1",
    "MaxQueue": "2000",
    "MaxTps": "50000",
    "MaxVhost": "200",
    "OrderType": "POST_PAID",
    "PrivateEndpoint": "rabbitmq-xxxx",
    "Status": "SERVING",
    "SupportEIP": "False",
    "name": "rabbitmq-xxxx"
  },
  "fields": {
    "ExpireTime": 4858070400000,
    "OrderCreateTime": 1702366576000,
    "MQTags": "[自定义标签列表]",
    "message": "{实例 JSON 数据}"
  }
}

部分参数说明如下

tags.Status(实例状态)取值含义:

取值 说明
DEPLOYING 实例部署中
EXPIRED 实例已过期
SERVING 实例服务中
RELEASED 实例已被释放

tags.OrderType(订单类型)取值含义:

取值 说明
PRE_PAID 预付费
POST_PAID 后付费

tags、fields 中的字段可能会随后续更新有所变动

tags.DBClusterId 值为实例 ID,作为唯一标识

X. 附录

请参考阿里云官方文档: