Reputation: 1745
I have some cgroups-managed services (actually running in docker). To fairly schedule some resource-demanding tasks, containerized services need to know it exact (as far as possible) resource usage. I've decided to read this metrics from cgroups.
But there is a problem. I known two ways to access cgroup data from docker container.
Mount cgroups directly from the inside of container. To accomplish that, I need to give CAP_SYS_ADMIN capability to container. I think this is too hard-boiled way to only read resource usage metrics.
Use docker volume, pointing to host cgroups mountpoint. This solution more or less appropriate, but I'am lookin' more elegant way.
I am not an "kernel-guy" and not familiar with kernel sources and documentation, so I am able to ask noob's question.
Is there any kernel interface which allows me to read cgroups metrics without mounting cgroups filesystem?
Upvotes: 1
Views: 563
Reputation: 6768
The only interface you get in the user space is by mounting cgroups or from the /proc/<pid>/cgourps
, (but only limited to the cgroups a process belongs to). If you are looking for a syscall() for reading cgroups data, its not available IMU. Docker requires cgroups services (cgconfig, cgred, etc)to be running, therefore its would require you to mount the cgroups.
Upvotes: 2