Skip to content

Collector 'Alibaba Cloud-OSS' Configuration Manual

Before reading this document, please read:

Tip

Before using this collector, you must install the 'Integration Core 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 be collected
regions[#] str Required Region ID. E.g.: 'cn-hangzhou'
See appendix for full list

2. Configuration Examples

Specify Regions

Collect data from Hangzhou and Shanghai regions

collector_configs = {
    'regions': [ 'cn-hangzhou', 'cn-shanghai' ]
}

Configure Filter (Optional)

This collector script supports custom filters, allowing users to filter target resources based on object attributes. The filter function returns True|False

  • True: The target resource should be collected.
  • False: The target resource should not be collected.

Supported object attributes for filtering:

Attribute Description
name Bucket name
storage_class Bucket storage type
location Bucket region
grant Bucket ACL permission
# Example: Enable filter to filter based on the location and name attributes of the object, configuration format is as follows:

def filter_bucket(bucket):

    bucket_location = bucket['location']
    bucket_name = bucket['name']
    if bucket_location in ['cn-north-4'] and bucket_name in ['xxx']:
        return True
    return False

###### Do not modify the following contents #####
from integration_core__runner import Runner
import integration_alibabacloud_oss__main as main

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

3. Data Reporting Format

After data is successfully synchronized, you can view the data in the 'Infrastructure-Resource Catalog' of TrueWatch.

Example of reported data:

{
  "measurement": "aliyun_oss",
  "tags": {
    "name"         : "ack-backup-hangzhou",
    "RegionId"     : "oss-cn-hangzhou",
    "storage_class": "IA",
    "location"     : "oss-cn-hangzhou",
    "grant"        : "private"
  },
  "fields": {
    "extranet_endpoint": "oss-cn-hangzhou.aliyuncs.com",
    "intranet_endpoint": "oss-cn-hangzhou-internal.aliyuncs.com",
    "creation_date"    : 1638415082,
    "message"          : "{Instance JSON data}"
  }
}
Note

Fields in tags and fields may change with subsequent updates.

Tip

The value of tags.name is the Bucket name, used as a unique identifier, and fields.message is the JSON serialized string.

X. Appendix

Please refer to the official Alibaba Cloud documentation: