Help Center/ Cloud Container Instance (CCI)/ User Guide/ Using CCI Through the Console/ Monitoring/ Querying Aggregated Metrics Using PromQL Statements
Updated on 2026-04-28 GMT+08:00

Querying Aggregated Metrics Using PromQL Statements

You can use Prometheus statements to combine basic metrics into aggregated metrics so that you can query object resource information quickly. This section provides some aggregated metrics, including CPU usage, memory usage, disk usage, disk read/write rate, network transmission error rate, network packet loss rate, and network transmit/receive rate. The metrics can be queried by Deployment, pod, or container. The aggregated metrics described in the table are only for reference. You can query other aggregated metrics using PromQL statements. For details about the Prometheus statement syntax, visit the Prometheus official website.

Category

Metric Name

Description

Implementation

CPU

deployment_cpu_usage

Query the percentage of the CPU limits in use across the containers of all pods of the workloads in different time periods.

label_replace(sum by (created_by_name,namespace)((sum by (pod,namespace)(rate(container_cpu_usage_seconds_total{image!=""}[5m])) / sum by(pod,namespace)(container_spec_cpu_quota{image!=""} /100000)) *on(pod,namespace)  group_left(created_by_kind,created_by_name) (count by (pod,created_by_kind,created_by_name,namespace)(kube_pod_info{created_by_kind='ReplicaSet'}))),"deployment","$1","created_by_name","(.*)-[^-]*")*100

Query the percentage of the CPU limits in use across the containers of all pods of a single workload in different time periods.

label_replace(sum by (created_by_name,namespace)((sum by (pod,namespace)(rate(container_cpu_usage_seconds_total{image!=""}[5m])) / sum by(pod,namespace)(container_spec_cpu_quota{image!=""} /100000)) *on(pod,namespace)  group_left(created_by_kind,created_by_name) (count by (pod,created_by_kind,created_by_name,namespace)(kube_pod_info{created_by_name =~ '{DEPLOYMENTNAME}.*',created_by_kind='ReplicaSet'}))),"deployment","$1","created_by_name","(.*)-[^-]*")*100

pod_cpu_usage

Query the percentage of the CPU limits in use across all containers of the pods in different time periods.

sum(rate(container_cpu_usage_seconds_total{image != ""}[5m])) by (pod, namespace) / (sum(container_spec_cpu_quota{image != ""}/100000) by (pod, namespace)) * 100

Query the percentage of the CPU limits in use across all containers of a single pod in different time periods.

sum(rate(container_cpu_usage_seconds_total{image != "",pod="{PODNAME}"}[5m])) by (pod, namespace) / (sum(container_spec_cpu_quota{image != "",pod="{PODNAME}"}/100000) by (pod, namespace)) * 100

container_cpu_usage

Query the percentage of the CPU limits in use across the containers in different time periods.

sum(rate(container_cpu_usage_seconds_total{image != ""}[5m])) by (pod,namespace,container) / (sum(container_spec_cpu_quota{image != ""}/100000) by (pod,namespace,container)) * 100

Query the percentage of the CPU limits in use across a single container in different time periods.

sum(rate(container_cpu_usage_seconds_total{image != "",pod="{PODNAME}",container="{CONTAINERNAME}"}[5m])) by (pod,namespace,container) / (sum(container_spec_cpu_quota{image != "",pod="{PODNAME}",container="{CONTAINERNAME}"}/100000) by (pod,namespace,container)) * 100

Memory

deployment_memory_usage

Query the percentage of the memory limits in use across the containers of all pods of the workloads in different time periods.

label_replace(sum by (created_by_name,namespace)((sum by (pod,namespace)(container_memory_working_set_bytes{image!=""}) / sum by(pod,namespace)(container_spec_memory_limit_bytes{image!=""})) *on(pod,namespace)  group_left(created_by_kind,created_by_name) (count by (pod,created_by_kind,created_by_name,namespace)(kube_pod_info{created_by_kind='ReplicaSet'}))),"deployment","$1","created_by_name","(.*)-[^-]*")*100

Query the percentage of the memory limits in use across the containers of all pods of a single workload in different time periods.

label_replace(sum by (created_by_name,namespace)((sum by (pod,namespace)(container_memory_working_set_bytes{image!=""}) / sum by(pod,namespace)(container_spec_memory_limit_bytes{image!=""})) *on(pod,namespace)  group_left(created_by_kind,created_by_name) (count by (pod,created_by_kind,created_by_name,namespace)(kube_pod_info{created_by_name =~ '{DEPLOYMENTNAME}.*',created_by_kind='ReplicaSet'}))),"deployment","$1","created_by_name","(.*)-[^-]*")*100

pod_memory_usage

Query the percentage of the memory limits in use across all containers of the pods in different time periods.

sum(container_memory_working_set_bytes{container!=""}) by (pod, namespace) / (sum(container_spec_memory_limit_bytes{container!=""}) by (pod, namespace)) * 100

Query the percentage of the memory limits in use across the containers of a single pod in different time periods.

sum(container_memory_working_set_bytes{container!="",pod="{PODNAME}"}) by (pod, namespace) / (sum(container_spec_memory_limit_bytes{container!="",pod="{PODNAME}"}) by (pod, namespace)) * 100

container_memory_usage

Query the percentage of the memory limits in use across the containers in different time periods.

sum(container_memory_working_set_bytes{container!=""}) by (pod, namespace,container) / (sum(container_spec_memory_limit_bytes{container!=""}) by (pod, namespace,container)) * 100

Query the percentage of the memory limits in use across a single container in different time periods.

sum(container_memory_working_set_bytes{container!="",pod="{PODNAME}",container="{CONTAINERNAME}"}) by (pod, namespace,container) / (sum(container_spec_memory_limit_bytes{container!="",pod="{PODNAME}",container="{CONTAINERNAME}"}) by (pod, namespace,container)) * 100

File system or disk

deployment_disk_usage

Queries the disk usages of Deployments.

label_replace(sum by (created_by_name,namespace)((sum by (pod,namespace)(container_fs_usage_bytes{image!=""}) / sum by(pod,namespace)(container_fs_limit_bytes{image!=""})) *on(pod,namespace)  group_left(created_by_kind,created_by_name) (count by (pod,created_by_kind,created_by_name,namespace)(kube_pod_info{created_by_kind='ReplicaSet'}))),"deployment","$1","created_by_name","(.*)-[^-]*")*100

Queries the disk usage of a Deployment.

label_replace(sum by (created_by_name,namespace)((sum by (pod,namespace)(container_fs_usage_bytes{image!=""}) / sum by(pod,namespace)(container_fs_limit_bytes{image!=""})) *on(pod,namespace)  group_left(created_by_kind,created_by_name) (count by (pod,created_by_kind,created_by_name,namespace)(kube_pod_info{created_by_name =~ '{DEPLOYMENTNAME}.*',created_by_kind='ReplicaSet'}))),"deployment","$1","created_by_name","(.*)-[^-]*")*100

pod_disk_usage

Queries the disk usages of pods.

(sum(container_fs_usage_bytes{container!=""}) by (pod)) / (sum(container_fs_limit_bytes{container!=""})  by (pod)) * 100

Queries the disk usage of a pod.

(sum(container_fs_usage_bytes{container!="",pod="{PODNAME}"}) by (pod)) / (sum(container_fs_limit_bytes{container!="",pod="{PODNAME}"})  by (pod)) * 100

container_disk_usage

Queries the disk usages of containers.

(sum(container_fs_usage_bytes{container!=""}) by (pod,container)) / (sum(container_fs_limit_bytes{container!=""})  by (pod,container)) * 100

Queries the disk usage of a container.

(sum(container_fs_usage_bytes{container!="",pod="{PODNAME}",container="{CONTAINERNAME}"}) by (pod,container)) / (sum(container_fs_limit_bytes{container!="",pod="{PODNAME}",container="{CONTAINERNAME}"})  by (pod,container)) * 100

disk_read_kilobytes

Queries the disk read rate.

sum(rate(container_fs_reads_total{container!=""}[5m])) by(namespace)

disk_write_kilobytes

Queries the disk write rate.

sum(rate(container_fs_writes_total{container!=""}[5m])) by(namespace)

Network

deployment_network_transmit_error_packets

Queries the transmission error rates of Deployments.

label_replace(sum by (created_by_name,namespace)((sum by (pod,namespace)(container_network_transmit_packets_dropped_total{image!=""}) / sum by(pod,namespace)(container_network_transmit_packets_total{image!=""})) *on(pod,namespace)  group_left(created_by_kind,created_by_name) (count by (pod,created_by_kind,created_by_name,namespace)(kube_pod_info{created_by_kind='ReplicaSet'}))),"deployment","$1","created_by_name","(.*)-[^-]*")*100

Queries the transmission error rate of a Deployment.

label_replace(sum by (created_by_name,namespace)((sum by (pod,namespace)(container_network_transmit_packets_dropped_total{image!=""}) / sum by(pod,namespace)(container_network_transmit_packets_total{image!=""})) *on(pod,namespace)  group_left(created_by_kind,created_by_name) (count by (pod,created_by_kind,created_by_name,namespace)(kube_pod_info{created_by_name =~ '{DEPLOYMENTNAME}.*',created_by_kind='ReplicaSet'}))),"deployment","$1","created_by_name","(.*)-[^-]*")*100

pod_network_transmit_error_packets

Queries the transmission error rates of pods.

sum(rate(container_network_transmit_packets_dropped_total{container!=""}[5m])) by(namespace,pod)/sum(rate(container_network_transmit_packets_total{container!=""}[5m])) by(namespace,pod)* 100

Queries the transmission error rate of a pod.

sum(rate(container_network_transmit_packets_dropped_total{container!="",pod="{PODNAME}"}[5m])) by(namespace,pod)/sum(rate(container_network_transmit_packets_total{container!="",pod="{PODNAME}"}[5m])) by(namespace,pod)* 100

container_network_transmit_error_packets

Queries the transmission error rates of containers.

sum(rate(container_network_transmit_packets_dropped_total{container!=""}[5m])) by(namespace,pod,container)/sum(rate(container_network_transmit_packets_total{container!=""}[5m])) by(namespace,pod,container)* 100

Queries the transmission error rate of a container.

sum(rate(container_network_transmit_packets_dropped_total{container!="",pod="{PODNAME}",container="{CONTAINERNAME}"}[5m])) by(namespace,pod,container)/sum(rate(container_network_transmit_packets_total{container!="",pod="{PODNAME}",container="{CONTAINERNAME}"}[5m])) by(namespace,pod,container)* 100

deployment_network_receive_error_packets

Queries the packet loss rates of Deployments.

label_replace(sum by (created_by_name,namespace)((sum by (pod,namespace)(container_network_receive_packets_dropped_total{image!=""}) / sum by(pod,namespace)(container_network_receive_packets_total{image!=""})) *on(pod,namespace)  group_left(created_by_kind,created_by_name) (count by (pod,created_by_kind,created_by_name,namespace)(kube_pod_info{created_by_kind='ReplicaSet'}))),"deployment","$1","created_by_name","(.*)-[^-]*")*100

Queries the packet loss rate of a Deployment.

label_replace(sum by (created_by_name,namespace)((sum by (pod,namespace)(container_network_receive_packets_dropped_total{image!=""}) / sum by(pod,namespace)(container_network_receive_packets_total{image!=""})) *on(pod,namespace)  group_left(created_by_kind,created_by_name) (count by (pod,created_by_kind,created_by_name,namespace)(kube_pod_info{created_by_name =~ '{DEPLOYMENTNAME}.*',created_by_kind='ReplicaSet'}))),"deployment","$1","created_by_name","(.*)-[^-]*")*100

pod_network_receive_error_packets

Queries the packet loss rates of pods.

sum(rate(container_network_receive_packets_dropped_total{container!=""}[5m])) by(namespace,pod)/sum(rate(container_network_receive_packets_total{container!=""}[5m])) by(namespace,pod)* 100

Queries the packet loss rate of a pod.

sum(rate(container_network_receive_packets_dropped_total{container!="",pod="{PODNAME}"}[5m])) by(namespace,pod)/sum(rate(container_network_receive_packets_total{container!="",pod="{PODNAME}"}[5m])) by(namespace,pod)* 100

container_network_receive_error_packets

Queries the packet loss rates of containers.

sum(rate(container_network_receive_packets_dropped_total{container!=""}[5m])) by(namespace,pod,container)/sum(rate(container_network_receive_packets_total{container!=""}[5m])) by(namespace,pod,container)* 100

Queries the packet loss rate of a container.

sum(rate(container_network_receive_packets_dropped_total{container!="",pod="{PODNAME}",container="{CONTAINERNAME}"}[5m])) by(namespace,pod,container)/sum(rate(container_network_receive_packets_total{container!="",pod="{PODNAME}",container="{CONTAINERNAME}"}[5m])) by(namespace,pod,container)* 100

network_transmit_bytes

Queries the network transmit rate.

sum(rate(container_network_transmit_bytes_total{container!=""}[5m])) by(namespace)

network_receive_bytes

Queries the network receive rate.

sum(rate(container_network_receive_bytes_total{container!=""}[5m])) by(namespace)
  • When querying a Deployment, change {DEPLOYMENTNAME} in the statement to the name of the Deployment to be queried.
  • When querying a pod, change {PODNAME} in the statement to the name of the pod to be queried.
  • When querying a container, change {PODNAME} in the statement to the name of the pod where the container is running and {CONTAINERNAME} to the name of the container to be queried.
  • The calculation of aggregated CPU or memory metrics (such as usage) depends on the limit settings of the container. If the limits of a container are set to 0, the aggregated metric data queried using the Prometheus statement provided by CCI will be inaccurate. To ensure the validity of monitoring data, you are advised to set proper limits for each container.