跳转至

采集器「腾讯云-Redis」配置手册

阅读本文前,请先阅读:

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

1. 配置结构

本采集器配置结构如下:

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

2. 配置示例

指定地域

采集上海地域的数据

Python
1
2
3
collector_configs = {
    'regions': [ 'ap-shanghai' ]
}

配置过滤器(可选项)

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

支持筛选的对象属性:

属性 描述
InstanceId 实例 ID
InstanceName 实例名称
BillingMode 计费模式
Engine 引擎
Port 实例端口号
ProductType 产品类型
ProjectId 项目 ID
Status 实例当前状态
Type 实例类型
WanIp 实例 VIP
ZoneId 区域 ID
Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# 示例:开启过滤器,根据对象的 InstanceId 和 ProductType 属性过滤,配置格式如下:

def filter_instance(instance):
    '''
    return True|False
    '''
    instance_id = instance['InstanceId']
    product_type = instance['ProductType']
    if instance_id in ['xxx'] and product_type in ['cluster']:
        return True
    return False

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

def run():
    Runner(main.DataCollector(account, collector_configs, filters=[filter_instance])).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
25
26
27
{
  "measurement": "tencentcloud_redis",
  "tags": {
    "name"        : "crs-xxxx",
    "BillingMode" : "0",
    "Engine"      : "Redis",
    "InstanceId"  : "crs-xxxx",
    "InstanceName": "solution",
    "Port"        : "6379",
    "ProductType" : "standalone",
    "ProjectId"   : "0",
    "RegionId"    : "ap-shanghai",
    "Status"      : "2",
    "Type"        : "6",
    "WanIp"       : "172.x.x.x",
    "ZoneId"      : "200002"
  },
  "fields": {
    "ClientLimits"    : "10000",
    "Createtime"      : "2022-07-14 13:54:14",
    "DeadlineTime"    : "0000-00-00 00:00:00",
    "InstanceNodeInfo": "{实例节点信息}",
    "InstanceTitle"   : "运行中",
    "Size"            : 1024,
    "message"         : "{实例 JSON 数据}"
  }
}

部分字段说明如下,具体可看附录接口返回参数

字段 类型 说明
Size Float 实例容量大小,单位:MB
BillingMode Integer 计费模式:0-按量计费,1-包年包月
Engine String 引擎:社区版 Redis、腾讯云 CKV
ProductType String 产品类型:standalone – 标准版,cluster – 集群版
Status Integer 实例当前状态
0:待初始化
1:实例在流程中
2:实例运行中
-2:实例已隔离
-3:实例待删除
Type Integer 实例类型:
1 – Redis2.8 内存版(集群架构)
2 – Redis2.8 内存版(标准架构)
3 – CKV 3.2 内存版(标准架构)
4 – CKV 3.2 内存版(集群架构)
5 – Redis2.8 内存版(单机)
6 – Redis4.0 内存版(标准架构)
7 – Redis4.0 内存版(集群架构)
8 – Redis5.0 内存版(标准架构)
9 – Redis5.0 内存版(集群架构)
InstanceNodeInfo Array 实例节点信息

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

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

fields.message、fields.InstanceNode 为 JSON 序列化后字符串

X. 附录

请参考腾讯云官方文档: