From 6781bab5215d7fe086b51e8a5ae901481ec48f5e Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Sat, 10 Feb 2018 13:32:21 -0500 Subject: [filesys] Clean lsof output, capture lslocks and mountinfo for pids Cleans the output of lsof, removing errors and warnings that are expected due to the lsof command that is being run. Other errors that lsof might produce to stderr are still preserved. Additionally, capture lslocks output and /proc/pid/mountinfo for each pid. Resolves: #1212 Signed-off-by: Jake Hunsaker Signed-off-by: Bryn M. Reeves --- sos/plugins/filesys.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sos/plugins/filesys.py b/sos/plugins/filesys.py index 75beb5a1..d14d1976 100644 --- a/sos/plugins/filesys.py +++ b/sos/plugins/filesys.py @@ -36,13 +36,15 @@ class Filesys(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): "/proc/self/mounts", "/proc/self/mountinfo", "/proc/self/mountstats", - "/etc/fstab", + "/proc/[0-9]*/mountinfo", + "/etc/fstab" ]) self.add_cmd_output("mount -l", root_symlink="mount") self.add_cmd_output("df -al -x autofs", root_symlink="df") self.add_cmd_output([ "df -ali -x autofs", - "findmnt" + "findmnt", + "lslocks" ]) if self.get_option('lsof'): @@ -66,4 +68,11 @@ class Filesys(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): r"\1********" ) + # remove expected errors from lsof due to command formatting, but still + # keep stderr so other errors are reported + regex = (r"(lsof: (avoiding (.*?)|WARNING: can't stat\(\) (.*?))|" + "Output information may be incomplete.)\n") + + self.do_cmd_output_sub("lsof", regex, '') + # vim: set et ts=4 sw=4 : -- cgit