Skip to content

Collector Configuration Manual for "GoogleCloud-Compute Engine Collection"

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

No additional configuration is required; the collector will automatically collect all resources within the scope of permission across all projects.

2. Configuration Example

Collector Configuration

Not required

Configuration Filter (Optional)

This collector script supports user-defined filters, allowing 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
zone Zone
publicIPAddress Public IP address
Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Example: Enable the filter to filter by the instanceName property. Configuration format as follows:
def filter_instance(instance):
    '''
    Collect instances with instanceName as xxx
    '''
    instance_name = instance['instanceName']
    if instance_name in ['xxx']:
        return True
    return False

@DFF.API('GoogleCloud-Compute Engine Collection', timeout=3600, fixed_crontab='*/15 * * * *')
def run():
    Runner(main.DataCollector(account, collector_configs, filters=[filter_instance])).run()

3. Data Reporting Format

After data synchronization, you can view the data under "TrueWatch" in the "Infrastructure - Resource Catalog".

Example of reported data:

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": "gcp_gce_instance",
  "tags": {
    "account_name": "xxx",
    "cloud_provider": "gcp",
    "instance_id": "41419888103617xxxx",
    "instance_name": "instance-20250402-xxxx",
    "instance_type": "e2-medium",
    "name": "//compute.googleapis.com/projects/xxx-453606/zones/us-central1-c/instances/instance-20250402-xxxx",
    "project_id": "xxx-453606",
    "project_name": "xxx",
    "public_ipaddress": "xx.xx.xx.xx",
    "region_id": "us-central1",
    "resource_name": "//compute.googleapis.com/projects/xxx-453606/zones/us-central1-c/instances/instance-20250402-xxxx",
    "zone": "us-central1-c"
  },
  "fields": {
    "disks": "{ Disk related data}",
    "labels": "{ Labels data }",
    "machine_info": "{ Host configuration }",
    "message": "{ Instance JSON data }",
    "network_interfaces": "{ Network Interface data }",
    "scheduling": "",
    "service_accounts": "",
    "status": "RUNNING",
    "tags": "{ Tags }"
  }
}

Fields in tags and fields may change with subsequent updates

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

The following fields are strings after JSON serialization

  • fields.message
  • fields.disks
  • fields.labels
  • fields.machine_info
  • fields.network_interfaces
  • fields.tags
  • fields.machine_info

X. Appendix

Google Cloud related documentation: