user16593576
user16593576

Reputation:

How to modify the promql query to get sum of CPU usages of the all the pods belong to one service?

How to modify the promql query to get the sum of all the pods (replicas) CPU usage belonging to one particular service?

To get the CPU usage of a single pod I use the following query :

rate(container_cpu_usage_seconds_total{pod="pod name",container="container name"}[5m]) by (container)

How can I modify this?

Upvotes: 1

Views: 1984

Answers (1)

Amirreza Hashemi
Amirreza Hashemi

Reputation: 362

You can use sum(rate(container_cpu_usage_seconds_total{pod="pod name",container="container name"}[5m])) by (container) to get the sum of all the pods (replicas) CPU usage belonging to one particular service.

Upvotes: 1

Related Questions