- docker.cpu.system
- The percent of time the CPU is executing system calls on behalf of processes of this container, unnormalized
- percent
- docker.cpu.user
- The percent of time the CPU is under direct control of processes of this container, unnormalized
- percent
- docker.cpu.usage
- The percent of CPU time obtained by this container
- percent
- docker.cpu.throttled
- Number of times the cgroup has been throttled
- docker.cpu.shares
- Shares of CPU usage allocated to the container
计算公式
docker.cpu.user = RATE(user)
docker.cpu.system = RATE(system)
docker.cpu.usage = RATE(usage / 10000000)
docker.cpu.throttled = RATE(nr_throttled)
docker.cpu.shares = RATE(shares)
数据来源
容器对应的cpuacct.stat and cpuacct.usage文件可能在如下三个位置:
- /sys/fs/cgroup/cpuacct/docker/<container_id>/
- /sys/fs/cgroup/cpuacct/kubepods/burstable/<pod_id>/<container_id>/
- /sys/fs/cgroup/cpuacct/kubepods/besteffort/<pod_id>/<container_id>/
- /sys/fs/cgroup/cpuacct/kubepods/<pod_id>/<container_id>/
容器对应的cpu.stat and cpu.shares文件可能在如下三个位置:
- /sys/fs/cgroup/cpu/docker/<container_id>/
- /sys/fs/cgroup/cpu/kubepods/burstable/<pod_id>/<container_id>/
- /sys/fs/cgroup/cpu/kubepods/besteffort/<pod_id>/<container_id>/
- /sys/fs/cgroup/cpu/kubepods/<pod_id>/<container_id>/
文件示例内容如下:
# cat cpuacct.stat
user 119045
system 75873
# cat cpuacct.usage
2397517073279
# cat cpu.stat
nr_periods 0
nr_throttled 0
throttled_time 0
# cat cpu.shares
1024