Collector "AWS-EBS" Configuration Manual¶
Before reading this document, please read:
Tip
Before using this collector, you must install the "Integration Core Package" and its corresponding 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 the appendix for the complete list |
2. Configuration Examples¶
Specify Regions¶
Collect instance data from Ningxia and Beijing regions
Configure 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 |
---|---|
VolumeId |
EBS Volume ID |
VolumeName |
EBS Volume Name |
VolumeType |
EBS Volume Type |
AvailabilityZone |
Availability Zone |
Example:
# Example: Enable filter and filter based on the VolumeId attribute of the object. Configuration format is as follows:
def filter_instance(instance, namespace='AWS/EBS'):
'''
Collect metrics for InstanceId i-xxxxxa, i-xxxxxb and RegionId cn-northwest-1
'''
volume_id = instance['tags'].get('InstanceId')
if volume_id in ['xxx']:
return True
return False
from integration_core__runner import Runner
import integration_aws_ebs__main as main
@DFF.API('AWS-EBS Collection', timeout=3600, fixed_crontab='*/15 * * * *')
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.
Example of reported data:
{
"measurement": "aws_ebs",
"tags": {
"name" : "vol-049d8fxxxxxxx",
"VolumeId" : "vol-049d8fxxxxxxx",
"VolumeType" : "gp2",
"VolumeName" : "test",
"RegionId" : "cn-northwest-1",
"AvailabilityZone": "cn-northwest-1a",
},
"fields": {
"CreateTime" : "2023-11-16T13:05:13.549000Z",
"Iops" : 100,
"Size" : 10,
"SnapshotId" : "snap-09ee56fexxxxxxx",
"State" : "in-use",
"Attachments": "{Attachments Information}",
"message" : "{Instance JSON Data}"
}
}
Note
Fields in tags and fields may change with subsequent updates.
Tip
The value of tags.name is the instance ID, which serves as the unique identifier.
Tip
fields.message and fields.Attachments are JSON serialized strings.
4. IAM Policy Permissions¶
Note
If users collect resources using IAM roles, certain operation permissions need to be enabled.
This collector requires the following operation permissions:
ec2:DescribeVolumes
X. Appendix¶
Refer to AWS official documentation: