Skip to content

Configuration Manual for Collector 「Alibaba Cloud-OSS」

Before reading this, please refer to:

Before using this collector, you must install the 'Integration Core Package' and its associated 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. Example: 'cn-hangzhou'
See the complete table in the appendix

2. Configuration Examples

Specifying Regions

Collect data from Hangzhou and Shanghai regions.

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

Configuring Filters (Optional)

This collector script supports user-defined filters that allow users to filter target resources by object attributes. The filter function returns True or False.

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

Supported object attributes for filtering:

Attribute Description
name Bucket name
storage_class Bucket storage class
location Bucket region
grant Bucket ACL permissions
Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Example: Enable filters based on the location and name properties of the object, with the following configuration format:

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 guance_integration__runner import Runner
import guance_aliyun_oss__main as main

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

3. Data Reporting Format

After data is synchronized successfully, it can be viewed in the 'Infrastructure - Resource Catalog' section of {{( brand_name }}}.

Example of reported data:

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
{
  "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"          : "{JSON serialized instance data}"
  }
}

Fields in tags and fields may change with subsequent updates

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

X. Appendix

Please refer to the official Alibaba Cloud documentation: