Created
September 30, 2021 16:11
-
-
Save abiydv/e84aae5a07ca9f3427ddbf37bf77f9fe to your computer and use it in GitHub Desktop.
Pod CPU Usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PromQL query to calculate how much CPU a particular pod is consuming on a particular instance | |
# Labels available after this query - ec2 and pod | |
# | |
# Required: node_exporter exposing node_cpu* metrics | |
# cadvisor exposing container_cpu* metrics | |
# | |
sum(label_replace(rate(container_cpu_usage_seconds_total{cluster="k8s"}[1m]), | |
"ec2", "$1", "instance", "(.+):.+")) by (ec2, pod) / ignoring (pod) group_left | |
sum(label_replace(rate(node_cpu_seconds_total{cluster="k8s"}[1m]), | |
"ec2", "$1", "instance", "(.+):.+")) by (ec2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment