Collect cgroup dir name from proc FS
Hey Guillaume,
Recent versions of docker, and by extension Kubernetes, name their containers based on the directory name of the cgroup they are assigned. That information can be found in /proc/[pid]/cgroup.
I didn't see a way to collect this info for a process in the documentation. Do you intend to add it in at some point? If there are not already efforts involved in it, I would like to try to insert that into the code.
It doesn't seem to be an information you can get on other systems, so sysinfo doesn't seem to be the right place to add it.
Potentially it can be a feature specific component? I can see a lot of uses for it, but I understand if this isn't in line with how you see sysinfo progressing!
An alternative approach would be to treat it as "container ID". Since windows and other operating systems can also run containers, that would be useful across systems.
The method for Linux would be to look at cgroup Dir name. I can find the method for other platforms.
Hey Guillaume, didn't get anything from you regarding this. Can you just let me know if that idea sounds good to you?
If not, I'll drop this idea and just modify sysinfo myself and not make a PR back to your repo. Don't want to bother you, just want to know if you'd like me to bring my code additions back to this repo.
Like I said, if this information can be retrieved on all supported systems (and freebsd too, arriving soon hopefully), then I don't mind adding this. Otherwise no. No platform-specific feature in sysinfo.
Perfect . thanks
Seems like it is a platform-specific information. Closing it as wontfix then.
I completely forgot to get back to you on it! I believe container names are universal, but the data structure in which they are stored is different in each platform so you need to dig into the details. Unfortunately, I'm not able to do this right now, but as far as I know, it is possible within your vision for sysinfo.
If you can get this information for all supported systems, then it's ok. I won't be working on it though.
Sounds good. Do you want to close it for now, since I probably can't work on it for a while? I can throw a comment in here once I have progress.
Let's keep it open until then. Simpler than closing/opening depending on the status.