yet-another-cloudwatch-exporter
                                
                                 yet-another-cloudwatch-exporter copied to clipboard
                                
                                    yet-another-cloudwatch-exporter copied to clipboard
                            
                            
                            
                        [BUG] CPU Metrics incorrectly showing as 0
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
We are monitoring a Linux EC2 instance using the latest version of YACE. YACE appears to not be pulling CPU Utilization metrics from Cloudwatch but is pulling other metrics with respect to the same EC2 instance.
Example:
Cloudwatch shows data

YACE Exported Data:
aws_ec2_cpuutilization_average{account_id="<accountnumber>",dimension_AutoScalingGroupName="",dimension_ImageId="",dimension_InstanceId="i-<instancenumber>",dimension_InstanceType="",name="arn:aws:ec2:eu-west-2:<accountnumber>:instance/i-<instancenumber>",region="eu-west-2"} 0
Grafana showing the exported data:

We have discounted:
- IAM permissions - these are the same as other EC2 instances which are pulling data
- grafana (stats in Grafana were identical to raw metrics from the exporter itself)
- Added Maximum, Minimum and Sum options for the ec2cpuutilization metric to eliminate the average value as the cause. All metric statistic options showed a value of Zero.
- Port-forwarded to the cloudwatch-exporter pod (YACE). All metrics here showed zero, thus eliminating Prometheus and Grafana as the root cause.
YACE Configuration is here and here.
Expected Behavior
We expect the metrics to be non-zero for CPU.
Steps To Reproduce
Unsure how reproducible this is given that other EC2 instances are exporting metrics.
To attempt to reproduce however, export CPU metrics on a linux instance using the latest YACE exporter.
Anything else?
This bug is being raised off of the back of this issue.
@Gary-H9 I'm seeing similar with RDS. Did you manage to find a solution?
👋🏻 Hey @tonyfosterdev, apologies it was some time ago and my memory is a bit hazy on it.
My colleague put an up date here.
TLDR We weren't sure why but it started working.