sysinfo icon indicating copy to clipboard operation
sysinfo copied to clipboard

Collect cgroup dir name from proc FS

Open thesw4rm opened this issue 4 years ago • 11 comments

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.

thesw4rm avatar Nov 09 '21 21:11 thesw4rm

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.

GuillaumeGomez avatar Nov 10 '21 09:11 GuillaumeGomez

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!

thesw4rm avatar Nov 11 '21 17:11 thesw4rm

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.

thesw4rm avatar Nov 11 '21 19:11 thesw4rm

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.

thesw4rm avatar Nov 15 '21 17:11 thesw4rm

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.

GuillaumeGomez avatar Nov 15 '21 18:11 GuillaumeGomez

Perfect . thanks

thesw4rm avatar Nov 15 '21 18:11 thesw4rm

Seems like it is a platform-specific information. Closing it as wontfix then.

GuillaumeGomez avatar Jul 04 '22 16:07 GuillaumeGomez

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.

thesw4rm avatar Jul 05 '22 21:07 thesw4rm

If you can get this information for all supported systems, then it's ok. I won't be working on it though.

GuillaumeGomez avatar Jul 05 '22 21:07 GuillaumeGomez

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.

thesw4rm avatar Jul 05 '22 21:07 thesw4rm

Let's keep it open until then. Simpler than closing/opening depending on the status.

GuillaumeGomez avatar Jul 05 '22 21:07 GuillaumeGomez