aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2016-12-08 11:08:50 -0500
committerBryn M. Reeves <bmr@redhat.com>2017-01-19 15:21:20 +0000
commitaf36c011bd420d61bbe84d9566a61464839ee614 (patch)
tree11565c4e3916bdaced7721e1110c70383e00ed99
parent679b1efe034c918207ed6e84818822cf78c20d53 (diff)
downloadsos-af36c011bd420d61bbe84d9566a61464839ee614.tar.gz
[docker] Capture cert, network, sizing and stats data
Captures a directory listing of /etc/docker to show the cert structure for the daemon. Now captures network listing and inspect details for configured docker networks. Adds a new 'size' option that when enabled captures 'ps -as' output. This is disabled by default as this could be very slow for hosts with large containers. Now captures output from 'docker stats' for containers running when sos is run. Closes: #901. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/docker.py33
1 files changed, 31 insertions, 2 deletions
diff --git a/sos/plugins/docker.py b/sos/plugins/docker.py
index 452cf769..ffe5cfce 100644
--- a/sos/plugins/docker.py
+++ b/sos/plugins/docker.py
@@ -29,7 +29,8 @@ class Docker(Plugin):
("all", "enable capture for all containers, even containers "
"that have terminated", 'fast', False),
("logs", "capture logs for running containers",
- 'fast', False)
+ 'fast', False),
+ ("size", "capture image sizes for docker ps", 'slow', False)
]
def setup(self):
@@ -37,12 +38,40 @@ class Docker(Plugin):
"/var/lib/docker/repositories-*"
])
- for subcmd in ['info', 'ps', 'ps -a', 'images', 'version']:
+ subcmds = [
+ 'info',
+ 'images',
+ 'network ls',
+ 'ps',
+ 'ps -a',
+ 'stats --no-stream',
+ 'version'
+ ]
+
+ for subcmd in subcmds:
self.add_cmd_output(
"{0} {1}".format(self.docker_cmd, subcmd)
)
+ # separately grab ps -s as this can take a *very* long time
+ if self.get_option('size'):
+ self.add_cmd_output('{0} ps -as'.format(self.docker_cmd))
+
self.add_journal(units="docker")
+ self.add_cmd_output("ls -alhR /etc/docker")
+
+ net_cmd = '{0} network ls'.format(self.docker_cmd)
+ nets = self.get_command_output(net_cmd)
+
+ if nets['status'] == 0:
+ n = [n.split()[1] for n in nets['output'].splitlines()[1:]]
+ for net in n:
+ self.add_cmd_output(
+ "{0} network inspect {1}".format(
+ self.docker_cmd,
+ net
+ )
+ )
ps_cmd = "{0} ps -q".format(self.docker_cmd)
if self.get_option('all'):