Collector "AWS-MQ" Configuration Manual¶
Before reading this document, please read:
Tip
Before using this collector, you must install the "Integration Core Package" and its accompanying third-party dependencies.
1. Configuration Structure¶
The configuration structure of this collector is as follows:
Field | Type | Required | Description |
---|---|---|---|
regions |
list | Required | List of regions to be collected |
regions[#] |
str | Required | Region ID. For example: 'cn-north-1' See appendix for full list |
2. Configuration Examples¶
Specifying Regions¶
Collect instance data from Ningxia and Beijing regions
Configuring Filters (Optional)¶
This collector script supports custom filters, allowing users to target resources based on 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 | The ARN of the broker |
BrokerId | The unique ID generated by AmazonMQ for the broker |
BrokerName | The name of the broker. This value is unique within your Amazon Web Services account |
BrokerState | The state of the broker |
DeploymentMode | The deployment mode of the broker |
EngineType | The type of the broker |
HostInstanceType | The instance type of the broker |
# Example: Enable filter and filter based on the BrokerName and EngineType attributes of the object. The configuration format is as follows:
def filter_instance(instance):
'''
Collect instances where BrokerName is xxx and EngineType is RabbitMQ
'''
# return True
borker_name = instance['BrokerName']
engine_type = instance['EngineType']
if borker_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 is successfully synchronized, you can view the data in the "Infrastructure - Resource Catalog" of TrueWatch.
An example of the reported data is as follows:
{
"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": "{Instance JSON Data}"
}
}
Note
The fields in tags and fields may change with subsequent updates.
Tip
The value of tags.name is the instance ID, which serves as a unique identifier.
Tip
fields.message is a JSON serialized string.
4. IAM Policy Permissions¶
Note
If users collect resources by assuming an IAM role, certain operation permissions need to be enabled.
This collector requires the following permissions:
mq:ListBrokers
X. Appendix¶
Please refer to the official AWS documentation: