Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cgroups] Collect cgroup information per process #3801

Merged

Conversation

jcastill
Copy link
Member

@jcastill jcastill commented Oct 5, 2024

Collect cgroup information for each process

Related: #3799


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname [email protected]?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?
  • Are all passwords or private data gathered by this PR obfuscated?

Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-3801
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@@ -26,7 +26,8 @@ def setup(self):

self.add_copy_spec([
"/proc/cgroups",
"/sys/fs/cgroup"
"/sys/fs/cgroup",
"/proc/*/cgroup",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this and it works, but this will go through all subdirs of /proc, and only collects 'cgroup' when it finds it.
We do something similar but more elegantly in the 'process' plugin:

self.add_copy_spec([
f"/proc/{proc}/status",
f"/proc/{proc}/cpuset",
f"/proc/{proc}/oom_*",
f"/proc/{proc}/stack",
f"/proc/{proc}/limits",
])

So my question is, is my approach good enough, or should I use the one in the process plugin gathering the PID entries with:

procs = [p for p in self.listdir("/proc") if re.match("[0-9]", p)]

Then iterating through them?

Copy link
Member

@TurboTurtle TurboTurtle Oct 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/proc/[0-9]*/cgroup

Collect cgroup information for each process

Related: sosreport#3799

Signed-off-by: Jose Castillo <[email protected]>
@jcastill jcastill force-pushed the jcastillo-collect-proc-pid-cgroups branch from 037bc39 to df79333 Compare October 7, 2024 08:14
Copy link
Contributor

@samuelkarp samuelkarp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@jcastill jcastill marked this pull request as ready for review October 14, 2024 11:18
@TurboTurtle TurboTurtle merged commit 3fa3a33 into sosreport:main Oct 14, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants