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

check-process.rb: Processes owned by users with names longer than 7 characters cannot be matched using -u switch #114

Open
makayez opened this issue Jun 10, 2020 · 0 comments

Comments

@makayez
Copy link

makayez commented Jun 10, 2020

When trying to match a process that is owned by a user with a long name fails to match using check-process.rb -u longusername

It appears this line in check-process.rb:
229 >> read_lines('ps axwwo user,pid,vsz,rss,pcpu,nlwp,state,etime,time,command').drop(1).map do |line|

Uses ps which by default truncates the username at 7 characters (adding a + at the end to indicate that the field is truncated). A possible fix for this would be to specify the length of the user field. I've tried this on a few flavors of linux successfully, but not an exhaustive test.

229 >> read_lines('ps axwwo user:30,pid,vsz,rss,pcpu,nlwp,state,etime,time,command').drop(1).map do |line|

It seems to make more sense to make the user column display length of the ps call set based on the length of the -u query so that it would have sufficient length to match the user delimiter parameter in the check.

@makayez makayez changed the title check-process.rb: Processes owned by users with names longer than 7 characters cannot be matched check-process.rb: Processes owned by users with names longer than 7 characters cannot be matched using -u switch Jun 10, 2020
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

No branches or pull requests

1 participant