Skip to content

Configuration Manual for the "Tencent Cloud-COS" Collector

Before reading this article, please first read:

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: 'ap-shanghai'
Refer to appendix for the full list

2. Configuration Examples

Specifying Regions

Collect data from COS instances in Shanghai region

Python
1
2
3
tencentcloud_configs = {
    'regions': [ 'ap-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 properties for filtering:

Property Description
Name Bucket name
BucketType Bucket type
Location Region
Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Example: Enable the filter based on the Location and Name properties of the object, with the following configuration format:

def filter_bucket(bucket):
    '''
    return True|False
    '''
    bucket_location = bucket['Location']
    bucket_name = bucket['Name']
    if bucket_location in ['ap-nanjing'] and bucket_name in ['xxx']:
        return True
    return False

###### Do not modify the following contents #####
from guance_integration__runner import Runner
import guance_tencentcloud_cos__main as main


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

3. Data Reporting Format

After the data has been successfully synchronized, you can view it in the {{( brand_name )}} "Infrastructure - Resource Catalog".

An example of the reported data is as follows:

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
  "measurement": "tencentcloud_cos",
  "tags": {
    "name"      : "smart-xxxx",
    "RegionId"  : "ap-nanjing",
    "BucketType": "cos",
    "Location"  : "ap-nanjing"
  },
  "fields": {
    "CreationDate": "2022-04-20T03:12:08Z",
    "message"     : "{Instance JSON data}"
  }
}

Fields in tags and fields may change with subsequent updates

tags.name comes from the Name field of the Tencent Cloud API

fields.message is a string after JSON serialization

X. Appendix

Please refer to the official Tencent Cloud documentation: