Skip to content

Configuration Manual for Collector "Tencent Cloud-MongoDB"

Before reading this, please read the following first:

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 MongoDB regions to be collected
regions[#] str Required Region ID. For example: 'ap-shanghai'. See the appendix for the full table

2. Configuration Example

Python
1
2
3
configs = {
    'regions' : ['ap-shanghai', 'ap-nanjing'],
}

Configuration Filter (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
InstanceId Instance ID
InstanceName Instance Name
InstanceType Instance Type
ClusterType Cluster Type
MongoVersion Instance Version
NetType Network Type
PayMode Payment Type
ProjectId Project ID
Status Current Instance Status
VpcId Private Network ID
Zone Availability Zone Information
Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Example: Enable the filter, filter based on the InstanceId and VpcId properties of the object, with the following configuration format:

def filter_instance(instance):
    '''
    return True|False
    '''
    instance_id = instance['InstanceId']
    vpc_id = instance['VpcId']
    if instance_id in ['xxx'] and vpc_id in ['yyy']:
        return True
    return False

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

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 the 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
{
  "measurement": "tencentcloud_mongodb",
  "tags": {
    "ClusterType" : "0",
    "InstanceId"  : "cmxxxx",
    "InstanceName": "test_01",
    "InstanceType": "1",
    "MongoVersion": "MONxxxx",
    "NetType"     : "1",
    "PayMode"     : "0",
    "ProjectId"   : "0",
    "RegionId"    : "ap-nanjing",
    "Status"      : "2",
    "VpcId"       : "vpc-nf6xxxxx",
    "Zone"        : "ap-nanjing-1",
    "name"        : "cmxxxx"
  },
  "fields": {
    "CloneInstances"   : "[]",
    "CreateTime"       : "2022-08-24 13:54:00",
    "DeadLine"         : "2072-08-24 13:54:00",
    "ReadonlyInstances": "[]",
    "RelatedInstance"  : "{JSON data of the instance}",
    "ReplicaSets"      : "{JSON data of the instance}",
    "StandbyInstances" : "[]",
    "message"          : "{JSON data of the instance}",
  }
}

Descriptions of some fields are provided below; for detailed information, refer to the appendix interface response parameters.

Field Type Description
ClusterType string Cluster type
0: Replica set instance
1: Sharded instance
status string Instance status
0: Pending initialization
1: In process
2: Running
-2: Expired
InstanceType string Instance type
1: Standard instance
2: Temporary instance
3: Read-only instance
4: Disaster recovery instance
NetType string Network type
0: Basic network
1: Private network
PayMode string Payment type
1: Subscription
0: Pay-as-you-go

Fields in tags and fields may change with subsequent updates

The value of tags.name is the instance ID, which serves as a unique identifier

fields.message is the JSON serialized character

X. Appendix

Please refer to the official Huawei Cloud documentation: