Skip to content

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

@makayez

Description

@makayez

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions