Skip to content

Collector Configuration Manual for "Volcengine-NAT Gateway"

Before reading this article, 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 regions to collect data from
regions[#] str Required Region ID. For example: 'cn-shanghai'
See the full table in the appendix

2. Configuration Examples

Specify Regions

Collect data from the Shanghai region.

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

Configure Filters (Optional)

This collector script supports user-defined filters, allowing users to filter target resources based on 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
NatGatewayId ID of the NAT gateway
NatGatewayName Node name
Spec Specification of the NAT gateway
BillingType Billing method of the NAT gateway
1: Annual subscription.
2: Pay-as-you-go.
VpcId ID of the private network that the NAT gateway belongs to
SubnetId ID of the subnet that the NAT gateway belongs to
ZoneId ID of the primary availability zone that the NAT gateway belongs to
NetworkInterfaceId ID of the network card used by the NAT gateway
ProjectName Name of the project that the NAT gateway belongs to
Status Status of the NAT gateway
Available: Available.
Creating: Creating.
Pending: In operation.
Deleting: Deleting.
BusinessStatus Whether the NAT gateway is locked
Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Example: Enable the filter, filter based on the Id attribute of the object, with the following configuration format:
def filter_instance(instance):
    '''
    Collect instances where instance_id is xxxxx or instance_name is xxxxx
    '''
    # return True
    instance_id = instance['NatGatewayId']
    if instance_id in ['xxx']:
        return True
    return False

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

@DFF.API('Volcengine-NAT Collection', timeout=3600, fixed_crontab='* * * * *')
def run():
    collectors = [
        main.DataCollector(account, collector_configs),
        # main.DataCollector(account, collector_configs, filters=[filter_instance]),
    ]
    Runner(collectors).run()

3. Data Reporting Format

After the data is synchronized normally, you can view it 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
{
  "fields": {
    "CreationTime": "2024-04-08T14:01:10+08:00",
    "EipAddresses": "[Information about public IPs bound to the NAT gateway]",
    "DnatEntryIds": "{List of DNAT rule IDs}",
    "ExpiredTime": "",
    "Description": "",
    "SnatEntryIds": "{List of SNAT rule IDs}",
    "message": "{JSON data of the instance}"
  },
  "measurement": "volcengine_nat",
  "tags": {
    "BillingType": "2",
    "BusinessStatus": "Normal",
    "EipAddresses": "{Information about public IPs bound to the NAT gateway}",
    "NatGatewayId": "ngw-xxx",
    "NatGatewayName": "xxx",
    "NetworkInterfaceId": "eni-xxx",
    "ProjectName": "default",
    "RegionId": "cn-shanghai",
    "Spec": "Small",
    "Status": "Available",
    "SubnetId": "subnet-xxx",
    "VpcId": "vpc-xxx",
    "ZoneId": "cn-shanghai-a",
    "name": "ngw-xxx"
  }
}

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, fields.EipAddresses, fields.DnatEntryIds, and fields.SnatEntryIds are all JSON serialized strings.

X. Appendix

Please refer to the official Volcengine documentation: