当前位置: 首页 > article >正文

16.2 k8s容器基础资源指标讲解

本节重点介绍 :

  • 指标分析
    • cpu指标
    • mem指标
    • filesystem && disk.io指标
    • network指标
    • system指标
  • container_network_{tcp,udp}_usage_total 默认不采集是因为 --disable_metrics=tcp, udp ,因为开启cpu压力大看这里

指标分析

  • 下面的表格对比了prometheus和夜莺k8s-mon 的指标

cpu指标

夜莺指标名含义prometheus metrics或计算方式说明
cpu.util容器cpu使用占其申请的百分比sum (rate (container_cpu_usage_seconds_total[1m])) by( container) /( sum (container_spec_cpu_quota) by(container) /100000) * 1000-100的范围
cpu.idle容器cpu空闲占其申请的百分比100 - cpu.util0-100的范围
cpu.user容器cpu用户态使用占其申请的百分比sum (rate (container_cpu_user_seconds_total[1m])) by( container) /( sum (container_spec_cpu_quota) by(container) /100000) * 1000-100的范围
cpu.sys容器cpu内核态使用占其申请的百分比sum (rate (container_cpu_sys_seconds_total[1m])) by( container) /( sum (container_spec_cpu_quota) by(container) /100000) * 1000-100的范围
cpu.cores.occupy容器cpu使用占用机器几个核rate(container_cpu_usage_seconds_total[1m])0到机器核数上限,结果为1就是占用1个核
cpu.spec.quota容器的CPU配额container_spec_cpu_quota为容器指定的CPU个数*100000
cpu.throttled.util容器CPU执行周期受到限制的百分比sum by(container_name, pod_name, namespace) (increase(container_cpu_cfs_throttled_periods_total{container_name!=“”}[5m])) /<br>sum by(container_name, pod_name, namespace) (increase(container_cpu_cfs_periods_total[5m])) * 1000-100的范围
cpu.periods容器生命周期中度过的cpu周期总数counter型无需计算使用rate/increase 查看
cpu.throttled.periods容器生命周期中度过的受限的cpu周期总数counter型无需计算使用rate/increase 查看
cpu.throttled.time容器被节流的总时间 )counter型无需计算单位(纳秒

mem指标

夜莺指标名含义prometheus metrics或计算方式说明
mem.bytes.total容器的内存限制无需计算单位byte 对应pod yaml中resources.limits.memory
mem.bytes.used当前内存使用情况,包括所有内存,无论何时访问container_memory_rss + container_memory_cache + kernel memory单位byte
mem.bytes.used.percent容器内存使用率container_memory_usage_bytes/container_spec_memory_limit_bytes *100范围0-100
mem.bytes.workingset容器真实使用的内存量,也是limit限制时的 oom 判断依据container_memory_max_usage_bytes > container_memory_usage_bytes >= container_memory_working_set_bytes > container_memory_rss单位byte
mem.bytes.workingset.percent容器真实使用的内存量百分比container_memory_working_set_bytes/container_spec_memory_limit_bytes *100范围0-100
mem.bytes.cached容器cache内存量container_memory_cache单位byte
mem.bytes.rss容器rss内存量container_memory_rss单位byte
mem.bytes.swap容器cache内存量container_memory_swap单位byte

filesystem && disk.io指标

夜莺指标名含义prometheus metrics或计算方式说明
disk.bytes.total容器可以使用的文件系统总量container_fs_limit_bytes(单位:字节)
disk.bytes.used容器已经使用的文件系统总量container_fs_usage_bytes(单位:字节)
disk.bytes.used.percent容器文件系统使用百分比container_fs_usage_bytes/container_fs_limit_bytes *100范围0-100
disk.io.read.bytes容器io.read qpsrate(container_fs_reads_bytes_total)[1m](单位:bps)
disk.io.write.bytes容器io.write qpsrate(container_fs_write_bytes_total)[1m](单位:bps)

network指标

网卡指标都应该求所有interface的和计算
夜莺指标名含义prometheus metrics或计算方式说明
net.in.bytes容器网络接收数据总数rate(container_network_receive_bytes_total)[1m](单位:bytes/s)
net.out.bytes容器网络积传输数据总数)rate(container_network_transmit_bytes_total)[1m](单位:bytes/s)
net.in.pps容器网络接收数据包ppsrate(container_network_receive_packets_total)[1m](单位:p/s)
net.out.pps容器网络发送数据包ppsrate(container_network_transmit_packets_total)[1m](单位:p/s)
net.in.errs容器网络接收数据错误数rate(container_network_receive_errors_total)[1m](单位:bytes/s)
net.out.errs容器网络发送数据错误数rate(container_network_transmit_errors_total)[1m](单位:bytes/s)
net.in.dropped容器网络接收数据包drop ppsrate(container_network_receive_packets_dropped_total)[1m](单位:p/s)
net.out.dropped容器网络发送数据包drop ppsrate(container_network_transmit_packets_dropped_total)[1m](单位:p/s)
container_network_{tcp,udp}_usage_total 默认不采集是因为 --disable_metrics=tcp, udp ,因为开启cpu压力大看这里

system指标

夜莺指标名含义prometheus metrics或计算方式说明
sys.ps.process.count容器中running进程个数container_processes(单位:个)
sys.ps.thread.count容器中进程running线程个数container_threads(单位:个)
sys.fd.count.used容器中打开文件描述符个数container_file_descriptors(单位:个)
sys.fd.soft.ulimits容器中root process Soft ulimitcontainer_ulimits_soft(单位:个)
sys.socket.count.used容器中打开套接字个数container_sockets(单位:个)
sys.task.state容器中task 状态分布container_tasks_state(单位:个)

本节重点总结:

  • 指标分析
    • cpu指标
    • mem指标
    • filesystem && disk.io指标
    • network指标
    • system指标
  • container_network_{tcp,udp}_usage_total 默认不采集是因为 --disable_metrics=tcp, udp ,因为开启cpu压力大看这里

http://www.kler.cn/news/316421.html

相关文章:

  • java:word文件替换字段,word转pdf
  • 加密与安全_三种常见的注入攻击
  • 【通讯协议】S32K142芯片——LIN通信的学习和配置
  • 文档加密,如何设置?加密文档的10个小妙招值得参考!(电脑文件安全加密)
  • 【JavaSE】Java注解
  • 比亚迪技术面试(测试、测开)
  • STM32G474的SPI工作在从机模式
  • SpringCloud解读
  • 回归模型拟合效果的统计指标: 决定系数 R2 r2 r2_score
  • Jupyter的使用
  • 【RabbitMQ 项目】服务端:数据管理模块之虚拟机模块
  • Maven进阶-二、依赖
  • 面试金典题2.4
  • Rust 文件与 IO
  • 【网络】TCP/IP 五层网络模型:数据链路层
  • 苍穹外卖学习笔记(五)
  • 高级java每日一道面试题-2024年9月19日-框架篇[Mybatis篇]-说一下mybatis的一级缓存和二级缓存?
  • Android对象池的深入理解和使用
  • 7.搭建个人金融数据库之快速获取股票列表和基本信息!
  • PowerShell install 一键部署Oracle12c
  • Guava中Preconditions校验
  • 数据安全治理
  • JVM 字节码与 JIT 编译详解
  • 云原生信息安全:筑牢数字化时代的安全防线
  • Vue3:mitt实现组件通信
  • Three.js 3D人物漫游项目(下)
  • 统信服务器操作系统a版e版【dde桌面限制登录次数】介绍
  • 大数据处理技术:HBase的安装与基本操作
  • python画正方形、平行四边形、六边形、五角星、风车(四个半圆)
  • ansible远程自动化运维、常用模块详解