-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
add systemd unit pid matching to procstat #3459
Conversation
Here's what it looks like running against the systemd unit
Edit: Hrm, this does raise an issue. We have multiple points that would overwrite each other. Several of the processes share the same |
What about adding this as a cgroup option? I guess it would need to be specified as I'm not sure about the recursive pgrep calls, seems like too much since it is ran each gather, but I can imagine the cgroup or PGID setting or some other ways of selecting groups. I think the ID pool could be useful here, people are always free to use |
Well if we're going to go the cgroup route, what about changing the |
Implementation could be essentially that, but I think in the config it may be more discoverable as a cgroup option, since I wouldn't guess for a pidfile option to support this. |
PR updated to basically split apart the systemd & cgroup matching. The systemd matcher now only returns the master pid. The cgroup matcher will return all pids in the cgroup. |
Wasn't expecting it to be merged just yet, has no tests :-) |
This adds the ability to identify the process to monitor by asking systemd for the PID. It uses the "Main PID" value you can see in
systemctl status
. In the event that the "children" parameter istrue
, it grabs all the PIDs within the Cgroup that systemd creates for the service.I didn't want to add the "children" parameter to just systemd, so I also added it to the existing process matching stuff. Though it is a little heavy as it calls
pgrep
recursively until it reaches the end of the chain.Required for all PRs:
Closes #3439