How to map cgroup2 to proc/stat meminfo for monitoring equivalents

jdmgomoo

New Member
Joined
Jan 10, 2025
Messages
1
Reaction score
0
Credits
19
We monitor Linux for resource utilization using proc/stat & proc/meminfo.
I am trying to enable accurate monitoring when we are running in k8s using resource limits. Some if these seem to map well, but I am trying to make sure I understand if I can calculate metrics if they are not explicitly provided through cgroup2.

This is my first pass, any suggestions would be appreciated.

System User = cpu.status user_usec
System Nice = cpu.weight.nice
system Kernel = cpu.status system_usec

I see cpu.pressure, which is the inverse of some thinks like Idle.
If you wanted to still report the following is there a cgroup mapping that makes sense?
system Idle
system IoWait
system Irq
system SoftIrq
system Steal
system Guest
system GuestNice

Did did the same for memory

MemTotal = memory.max
MemFree = memory.max - memory.current
MemAvail = MemFree - memory.swap.current
Buffers & Cache are included in memory.current and can't be isolated?

Not sure if I can extract other meminfo properties using cgroup2.
This is what I understand, not sure if I am going in the right direct.
 
Top