Skip to content

Collector Configuration Manual for "AWS-MQ"

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-north-1'
See the full table in the appendix

2. Configuration Examples

Specifying Regions

Collect instance data from Ningxia and Beijing regions.

Python
1
2
3
collector_configs = {
    'regions': [ 'cn-northwest-1', 'cn-north-1' ]
}

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

Supported object attributes for filtering:

Attribute Description
BrokerArn ARN of the broker
BrokerId Unique ID generated by AmazonMQ for the broker
BrokerName Name of the broker. This value is unique within your Amazon Web Services account
BrokerState State of the broker
DeploymentMode Deployment mode of the broker
EngineType Type of the broker
HostInstanceType Instance type of the broker
Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Example: Enable a filter to filter based on the BrokerName and EngineType properties of the object. Configuration format is as follows:
def filter_instance(instance):
    '''
    Collect instances where BrokerName is xxx and EngineType is RabbitMQ
    '''
    # return True
    broker_name = instance['BrokerName']
    engine_type = instance['EngineType']
    if broker_name in ['xxx'] and engine_type in ['RabbitMQ']:
        return True
    return False


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

3. Data Reporting Format

After data synchronization, 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
{
  "measurement": "aws_mq",
  "tags": {
    "BrokerArn"       : "arn:xxx1",
    "BrokerId"        : "b-xxx1",
    "BrokerName"      : "xxx1",
    "BrokerState"     : "RUNNING",
    "DeploymentMode"  : "SINGLE_INSTANCE",
    "EngineType"      : "RabbitMQ",
    "HostInstanceType": "mq.m5.large",
    "name"            : "xxx1"
  },
  "fields": {
    "Created": "2024-01-05T07:55:07.687000Z",
    "message": "{JSON data of the instance}"
  }
}

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 string after JSON serialization.

4. IAM Policy Permissions

If the user collects resources using an assumed IAM role, certain operation permissions need to be enabled.

This collector requires the following permissions:

mq:ListBrokers

X. Appendix

Refer to the official AWS documentation: