diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2017-04-19 14:40:46 -0400 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-03-13 13:21:32 +0000 |
commit | ef0f4b1ce83b090120b26b2eb496ecba6318ba20 (patch) | |
tree | 27fb55a2adfec84850b1e52f94bf83b2ed7dcef2 | |
parent | c8a5039053cb6bc13518e0b249f37de290d317a7 (diff) | |
download | sos-ef0f4b1ce83b090120b26b2eb496ecba6318ba20.tar.gz |
[runc] Add new plugin
Adds a new plugin for the runC container runtime.
Collects a list of containers runc is aware of and the collects ps, event and
state output for each container.
Fixes: #993
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/runc.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sos/plugins/runc.py b/sos/plugins/runc.py new file mode 100644 index 00000000..9006c50d --- /dev/null +++ b/sos/plugins/runc.py @@ -0,0 +1,42 @@ +# Copyright (C) 2017 Red Hat, Inc. Jake Hunsaker <jhunsake@redhat.com> +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +from sos.plugins import Plugin, RedHatPlugin + + +class Runc(Plugin): + + """runC container runtime""" + + plugin_name = 'runc' + + def setup(self): + + self.add_cmd_output('runc list') + + cons = self.get_command_output('runc list -q') + conlist = [c for c in cons['output'].splitlines()] + for con in conlist: + self.add_cmd_output('runc ps %s' % con) + self.add_cmd_output('runc state %s' % con) + self.add_cmd_output('runc events --stats %s' % con) + + +class RedHatRunc(Runc, RedHatPlugin): + + packages = ('runc', ) + + def setup(self): + super(RedHatRunc, self).setup() |