container!="POD"
是过滤掉 pause 容器。这个 promql 比较难以理解,分子是:每秒内,容器用了多少CPU时间,分母是:每秒内,被限制使用多少CPU时间
sum(
irate(container_cpu_usage_seconds_total[3m])
) by (pod,id,namespace,container,ident,image)
/
sum(
container_spec_cpu_quota/container_spec_cpu_period
) by (pod,id,namespace,container,ident,image)
内存使用量除以内存限制量,就是使用率,但是后面跟了 and container_spec_memory_limit_bytes != 0
是因为有些容器没有配置 limit 的内存大小
container_memory_usage_bytes/container_spec_memory_limit_bytes
and
container_spec_memory_limit_bytes != 0
实际上,更应该用的是 container_memory_working_set_bytes
指标来计算内存使用率。详细参考 这篇文章。
这个比较简单,irate 之后乘以 8 是换算成 bit 作为单位
irate(container_network_receive_bytes_total[1m]) * 8
这个比较简单,irate 之后乘以 8 是换算成 bit 作为单位
irate(container_network_transmit_bytes_total[1m]) * 8
对于高算力需求的进程,如果分配的CPU不够用,这个指标会飙高,说明要升配了
increase(container_cpu_cfs_throttled_periods_total[1m])
/
increase(container_cpu_cfs_periods_total[1m]) * 100