Skip to content

Configuration Manual for the "Alibaba Cloud-OceanBase" Collector

Before reading this, please read the following first:

Before using this collector, you must install the 'Integration Core Package' and its corresponding third-party dependency packages

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 the complete table in the appendix

2. Configuration Example

Specify Regions

Collect data from Hangzhou and Shanghai regions.

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

Configure Filters (Optional)

This collector script supports user-defined filters, allowing users to filter target resources by object properties. The filter function should return True or False.

  • True: The target resource needs to be collected.
  • False: The target resource does not need to be collected.

Supported object properties for filtering:

Property Description
InstanceId Cluster ID
InstanceName Cluster Name
State Cluster Status
Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Example: Enable filters, filter by instance ID and name attributes, configure as follows:
def filter_instance(instance):
    '''
    Collect instances with InstanceId xxxxx or InstanceName 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 guance_integration__runner import Runner
import guance_aliyun_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 data synchronization is successful, you can view the data in the "Infrastructure - Resource Catalog" section of {{( brand_name }}}.

An example of reported data is as follows:

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
28
29
30
31
{
  "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-scaling configuration}",
    "DeployMode": "1-1-1",
    "DeployType": "dual",
    "DiskSize": 50,
    "ExpireTime": "2124-11-05T16:00:00Z",
    "InstanceClass": "4C16G",
    "Mem": 16,
    "PayType": "POSTPAY",
    "Resource": "{cluster resources information}",
    "UsedDiskSize": 1,
    "Version": "4.2.1.9",
    "VpcId": "vpc-bp12v3efx5klzh720t5zf",
    "message": "{instance JSON data}"
  }
}

Fields in tags and fields may change with subsequent updates

The value of tags.name is the instance ID, used as a unique identifier. fields.message, fields.DataDiskAutoScaleConfig, fields.Resource, and fields.AvailableZones are strings serialized in JSON format.

X. Appendix

Refer to the official Alibaba Cloud documentation: