I’m seeing a discrepancy between AWS CloudWatch CPUUtilization (%) and Grafana CPU usage (%) for the same EC2 instance, and I’m trying to understand why the percentages don’t match.
Context:
-
AWS service: EC2
-
Metrics source in Grafana: Prometheus
-
CloudWatch metric:
CPUUtilization(percentage) -
Grafana metric: CPU usage calculated from node exporter metrics
Issue:
Even when observing the same time range, the CPU percentage shown in CloudWatch differs significantly from the CPU percentage displayed in Grafana.
Questions:
-
How does CloudWatch calculate
CPUUtilization, and how does that differ from Prometheus/Grafana CPU calculations?
promql we use for grafana -
100 *(
1 -
avg by (node)(
rate(node_cpu_seconds_total{mode="idle",cluster="lk_prod", node=\~"$node"}\[$interval\]))
)

