处理Prometheus监控取值为+Inf

pod_memory_use表达式:

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

 说明:

!=+Inf

过滤正无穷的数据,如果容器没有定义限制内存,测container_spec_memory_limit_bytes值是0;

优化后的ProSQL公式:

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

 

posted @ 2024-01-12 11:25  呼长喜  阅读(209)  评论(0编辑  收藏  举报