Till today I used shell scripts that grep info out of /sys/fs/cgroup. Like
${LS} ${CGROUPDIR}/cpuset/lxc/*/cpuset.cpus | while read cgroupfile
do
lxc_name=echo ${cgroupfile} | $AWK -F/ '{print $7}' 2>/dev/null
lxc_cpus=${CAT} ${cgroupfile} 2>/dev/null
lxc_memory_usage=${CAT} ${CGROUPDIR}/memory/lxc/${lxc_name}/memory.usage_in_bytes 2>/dev/null
memory_usage_mb=echo ${lxc_memory_usage}/1024/1024 | ${BC} 2>/dev/null
if [ ${OPT_L} == “1” ]
then
echo -e “${lxc_name}\t${lxc_cpus}\t${memory_usage_mb}”
else
echo -n "${lxc_name} "
fi
done
Now I wanted to adapt this to LXC 5.0 where (some of) the files are in
/sys/fs/cgroup/lxc.payload.CONTAINER
/sys/fs/cgroup/lxc.monitor.CONTAINER
In this dirs all files have 0 length. Inside and outside the container. My question is why?