Skip to content

Collector「Tencent Cloud-MongoDB」Configuration Manual

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 collect data from
regions[#] str Required Region ID. For example: 'ap-shanghai'. Refer to the appendix for the full table

2. Configuration Example

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

Configuration 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 should be collected.
  • False: The target resource should not be collected.

Supported object attributes for filtering:

Attribute Description
InstanceId Instance ID
InstanceName Instance Name
InstanceType Instance Type
ClusterType Cluster Type
MongoVersion Instance Version Info
NetType Network Type
PayMode Payment Type
ProjectId Project ID
Status Current Instance Status
VpcId Private Network ID
Zone Availability Zone Info
Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Example: Enable the filter, filtering by the InstanceId and VpcId properties of the object, with the configuration format as follows:

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 the data synchronizes successfully, it can be viewed in the "Infrastructure - Resource Catalog" section of Guance and TrueWatch.

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 instance}",
    "ReplicaSets"      : "{JSON data of instance}",
    "StandbyInstances" : "[]",
    "message"          : "{JSON data of instance}",
  }
}

Descriptions of some fields are provided below; detailed information can be found in 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: Monthly 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, used as a unique identifier

fields.message is a JSON serialized string

X. Appendix

Refer to the official Huawei Cloud documentation: