采集器「阿里云-EIP」配置手册¶
阅读本文前,请先阅读:
Tip
使用本采集器前,必须安装「集成 Core 核心包」及其配套的第三方依赖包
1. 配置结构¶
本采集器配置结构如下:
字段 | 类型 | 是否必须 | 说明 |
---|---|---|---|
regions |
list | 必须 | 所需采集的地域列表 |
regions[#] |
str | 必须 | 地域 ID。如:'cn-hangzhou' 总表见附录 |
2. 配置示例¶
指定地域¶
采集杭州、上海地域的数据
配置过滤器(可选项)¶
本采集器脚本支持用户自定义过滤器,让用户通过对象属性筛选出目标资源。过滤器函数返回值为 True|False
-
True:目标资源需要被采集。
-
False 目标资源不需要被采集
支持筛选的对象属性:
属性 | 描述 |
---|---|
AllocationId | EIP 的实例 ID |
Name | EIP 的名称 |
IpAddress | EIP 的 IP 地址 |
Status | EIP 的状态 |
# 示例:开启过滤器,根据对象的实例 ID 和名称属性过滤,配置格式如下:
def filter_instance(instance):
'''
采集 AllocationId 为 xxxxx 或者 Name 为 xxxxx 的实例
'''
# return True
allocation_id = instance['AllocationId']
eip_name = instance['Name']
if allocation_id in ['xxxxx'] or eip_name in ['xxxxx']:
return True
return False
###### Do not modify the following contents #####
from integration_core__runner import Runner
import integration_alibabacloud_eip__main as main
@DFF.API('AlibabaCloud-EIP Collection', timeout=3600, fixed_crontab='*/15 * * * *')
def run():
Runner(main.DataCollector(account, collector_configs, filters=[filter_instance])).run()
3. 数据上报格式¶
数据正常同步后,可以在 观测云 的「基础设施-资源目录」中查看数据。
上报的数据示例如下:
{
"measurement": "aliyun_eip",
"tags": {
"name" : "eip-xxxxx",
"AllocationId" : "eip-bp1lfsikwo4roa0mcqg9u",
"EIPName" : "",
"Status" : "InUse",
"RegionId" : "cn-hangzhou",
"IpAddress" : "47.96.22.249",
},
"fields": {
"Bandwidth" : "1",
"InternetChargeType": "PayByTraffic",
"BusinessStatus" : "Normal",
"ChargeType" : "PostPaid",
"AllocationTime": "2022-01-20T03:06:51Z",
"ExpiredTime" : "",
"message" : "{实例 JSON 数据}"
}
}
部分参数说明如下:
tags.InternetChargeType
(付费类型)取值含义:
取值 | 说明 |
---|---|
PayByBandwidth |
按固定带宽计费 |
PayByTraffic |
按使用流量计费 |
tags.ChargeType
(计费模式)取值含义:
取值 | 说明 |
---|---|
PrePaid |
包年包月 |
PostPaid |
按量计费 |
tags.Status
(计费模式)取值含义:
取值 | 说明 |
---|---|
Associating |
绑定中 |
Unassociating |
解绑中 |
InUse |
以分配 |
Available |
可用 |
Releasing |
释放中 |
Note
tags、fields 中的字段可能会随后续更新有所变动
Tip
tags.name 值为实例 ID,作为唯一标识,fields.message 为 JSON 序列化后字符串
X. 附录¶
请参考阿里云官方文档: