yet-another-cloudwatch-exporter
yet-another-cloudwatch-exporter copied to clipboard
Question about usage AWS/EC2 CPUUtilization
Hi there,
Trying to collect basic metrics from EC2, however, metrics don't look consistent with what I actually have running on my AWS account.
Here is my config; config.yaml:
region: us-east-2
apiVersion: v1alpha1
discovery:
exportedTagsOnMetrics:
ec2:
- Name
jobs:
- type: ec2
regions:
- <my_region>
length: 900
delay: 120
period: 60
nilToZero: true
dimensionNameRequirements:
- InstanceId
searchTags:
- key: Application
value: <my_app_name>
metrics:
- name: CPUUtilization
statistics:
- Average
I only have 2 EC2 instances running on this AWS account with the tag Applicatoin=<my_app_name> and running the above config results in more than 2 metrics returned for the CPU utilisation, this is what I get
aws_ec2_cpuutilization_average{account_id="<my_account_id>",dimension_image_id="",dimension_instance_id="",dimension_instance_type="",name="global",region="<my_region>"} 1.7033333333333334
aws_ec2_cpuutilization_average{account_id="<my_account_id>",dimension_image_id="",dimension_instance_id="",dimension_instance_type="r6i.xlarge",name="global",region="<my_region>"} 1.7033333333333334
aws_ec2_cpuutilization_average{account_id="<my_account_id>",dimension_image_id="",dimension_instance_id="i-xxx",dimension_instance_type="",name="arn:aws:ec2:<my_region>:<my_account_id>:instance/i-xxx",region="<my_region>"} 1.795
aws_ec2_cpuutilization_average{account_id="<my_account_id>",dimension_image_id="",dimension_instance_id="i-yyy",dimension_instance_type="",name="arn:aws:ec2:<my_region>:<my_account_id>:instance/i-yyy",region="<my_region>"} 1.6116666666666668
aws_ec2_cpuutilization_average{account_id="<my_account_id>",dimension_image_id="ami-aaa",dimension_instance_id="",dimension_instance_type="",name="global",region="<my_region>"} 1.7033333333333334
This is what I would expect
aws_ec2_cpuutilization_average{account_id="<my_account_id>",dimension_image_id="ami-aaa",dimension_instance_id="i-xxx",dimension_instance_type="r6i.xlarge",name="arn:aws:ec2:<my_region>:<my_account_id>:instance/i-xxx",region="<my_region>"} 1.795
aws_ec2_cpuutilization_average{account_id="<my_account_id>",dimension_image_id="ami-bbb",dimension_instance_id="i-yyy",dimension_instance_type="r6i.xlarge",name="arn:aws:ec2:<my_region>:<my_account_id>:instance/i-yyy",region="<my_region>"} 1.6116666666666668
I'm not sure if this is a bug or simply a misconfiguration from my end, I simply followed the documentation for a basic metrics scrape. Any help would be appreciated.
I'm getting the same issue, seems like it's autoscaling group metrics
I'm getting the same issue, seems like it's autoscaling group metrics
This is correct, what you are seeing is the different dimension sets CloudWatch makes available for metrics. You can compare this to the All metrics screen in CloudWatch for EC2
You can use a relabel rule to drop metrics with a value of global for the name label to drop these metrics. Any metric which is not associated to a resource has a name of global. Note: some namespaces, like AWS/Billing, have no resources with all metrics have a global name so be careful to target this relabel.
Thanks @kgeckhart , So can any metrics with name = 'global' be dropped ?
I wouldn't suggest that there are a lot of incredibly useful metrics which will have a name of global. The name field is used to join to an associated resource in info metrics, global for a name indicates the metric is unmatched to a resource but does not indicate that it's not useful.