Collector 'Alibaba Cloud-OceanBase' Configuration Manual¶
Before reading this document, please read:
Tip
Before using this collector, you must install the 'Integration Core Package' and its accompanying third-party dependencies.
1. Configuration Structure¶
The configuration structure of this collector is as follows:
Field | Type | Required | Description |
---|---|---|---|
regions |
list | Required | List of regions to collect data from |
regions[#] |
str | Required | Region ID. For example: 'cn-hangzhou' See appendix for the complete list |
2. Configuration Examples¶
Specifying Regions¶
Collect data from Hangzhou and Shanghai regions
Configuring Filters (Optional)¶
This collector script supports custom filters, allowing users to filter target resources based on object attributes. The filter function returns True or False.
-
True: The target resource should be collected.
-
False: The target resource should not be collected.
Supported filterable object attributes:
Attribute | Description |
---|---|
InstanceId | Cluster ID |
InstanceName | Cluster Name |
State | Cluster Status |
# Example: Enable filter and filter based on instance ID and name attributes. Configuration format is as follows:
def filter_instance(instance):
'''
Collect instances with InstanceId as xxxxx or InstanceName as xxxxx
'''
# return True
instance_id = instance['InstanceId']
instance_name = instance['InstanceName']
if instance_id in ['xxxxx'] or instance_name in ['xxxxx']:
return True
return False
###### Do not modify the following contents #####
from integration_core__runner import Runner
import integration_alibabacloud_oceanbase__main as main
@DFF.API('AlibabaCloud-OceanBase Collection', timeout=3600, fixed_crontab='*/15 * * * *')
def run():
Runner(main.DataCollector(account, collector_configs, filters=[filter_instance])).run()
3. Data Reporting Format¶
After successful data synchronization, you can view the data in the 'Infrastructure-Resource Catalog' of TrueWatch.
Example of reported data:
{
"measurement": "aliyun_oceanbase",
"tags": {
"InstanceId": "ob67r23fni4zz4",
"InstanceName": "fyb-created",
"InstanceRole": "NORMAL",
"InstanceType": "cluster",
"ResourceGroupId": "rg-acfm4m3fh3iykdq",
"State": "ONLINE",
"name": "ob67r23fni4zz4"
},
"fields": {
"AvailableZones": "[\"h\", \"i\"]",
"Cpu": 4,
"CpuArchitecture": "X86",
"CreateTime": "2024-11-05T02:43:36Z",
"DataDiskAutoScaleConfig": "{Data Disk Auto Scale Configuration}",
"DeployMode": "1-1-1",
"DeployType": "dual",
"DiskSize": 50,
"ExpireTime": "2124-11-05T16:00:00Z",
"InstanceClass": "4C16G",
"Mem": 16,
"PayType": "POSTPAY",
"Resource": "{Cluster Resource Information}",
"UsedDiskSize": 1,
"Version": "4.2.1.9",
"VpcId": "vpc-bp12v3efx5klzh720t5zf",
"message" : "{Instance JSON Data}"
}
}
Note
Fields in tags and fields may change with subsequent updates.
Tip
The value of tags.name is the instance ID, serving as a unique identifier. fields.message, fields.DataDiskAutoScaleConfig, fields.Resource, and fields.AvailableZones are JSON serialized strings.
X. Appendix¶
Please refer to the official Alibaba Cloud documentation: