Skip to content

Uncaught exception in metrics-per-process.py #91

Description

@boutetnico

This seems related to #25.

I had 3 occurences of the following Exception:

Traceback (mo st recent call last):
  File "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-process-checks-3.2.0/bin/metrics-per-process.py", line 330, in <module>
    main()
  File "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-process-checks-3.2.0/bin/metrics-per-process.py", line 318, in main
    pids = find_pids_from_name(options.process_name)
  File "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-process-checks-3.2.0/bin/metrics-per-process.py", line 119, in find_pids_from_name
    return find_pids(matcher)
  File "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-process-checks-3.2.0/bin/metrics-per-process.py", line 104, in find_pids
    if matcher(path):
  File "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-process-checks-3.2.0/bin/metrics-per-process.py", line 116, in matcher
    file_handler = open(path + '/comm', 'r')
IOError: [Errno 2] No such file or directory: '/proc/19630/comm'

In #25 we catch OSError to cover the case when directory /proc/<pid>/ does not exist.
In this issue however, it seems /proc/<pid>/ exists but /proc/<pid>/comm does not.

I believe we should catch both OSError & IOError to cover both cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions