From 12d0d5f5f0fa69a103364ddf61149a1552a888b5 Mon Sep 17 00:00:00 2001 From: Pavel Moravec Date: Mon, 31 Aug 2015 13:05:04 +0200 Subject: [qpid] Add port and SSL related options Four options added: - port for specifying non-default listening port (sometimes necessary also for SSL) - ssl-certificate and ssl-key for SSL - ssl as rather auxiliary option to force qpid-* tools to use SSL even without ssl-* options specified Resolves: #634, #635 Signed-off-by: Pavel Moravec --- sos/plugins/qpid.py | 54 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/sos/plugins/qpid.py b/sos/plugins/qpid.py index 319c458f..a41a4afc 100644 --- a/sos/plugins/qpid.py +++ b/sos/plugins/qpid.py @@ -23,27 +23,47 @@ class Qpid(Plugin, RedHatPlugin): profiles = ('services',) packages = ('qpidd', 'qpid-cpp-server', 'qpid-tools') + option_list = [("port", "listening port to connect to", '', ""), + ("ssl-certificate", + "Path to file containing client SSL certificate", '', ""), + ("ssl-key", + "Path to file containing client SSL private key", '', ""), + ("ssl", "enforce SSL / amqps connection", '', False)] def setup(self): """ performs data collection for qpid broker """ + options = "" + amqps_prefix = "" # set amqps:// when SSL is used + if self.get_option("ssl"): + amqps_prefix = "amqps://" + # for either present option, add --option=value to 'options' variable + for option in ["ssl-certificate", "ssl-key"]: + if self.get_option(option): + amqps_prefix = "amqps://" + options = (options + " --%s=" % (option) + + self.get_option(option)) + if self.get_option("port"): + options = (options + " -b " + amqps_prefix + + "localhost:%s" % (self.get_option("port"))) + self.add_cmd_output([ - "qpid-stat -g", # applies since 0.18 version - "qpid-stat -b", # applies to pre-0.18 versions - "qpid-stat -c", - "qpid-stat -e", - "qpid-stat -q", - "qpid-stat -u", - "qpid-stat -m", # applies since 0.18 version - "qpid-config exchanges", - "qpid-config queues", - "qpid-config exchanges -b", # applies to pre-0.18 versions - "qpid-config queues -b", # applies to pre-0.18 versions - "qpid-config exchanges -r", # applies since 0.18 version - "qpid-config queues -r", # applies since 0.18 version - "qpid-route link list", - "qpid-route route list", - "qpid-cluster", # applies to pre-0.22 versions - "qpid-ha query", # applies since 0.22 version + "qpid-stat -g" + options, # applies since 0.18 version + "qpid-stat -b" + options, # applies to pre-0.18 versions + "qpid-stat -c" + options, + "qpid-stat -e" + options, + "qpid-stat -q" + options, + "qpid-stat -u" + options, + "qpid-stat -m" + options, # applies since 0.18 version + "qpid-config exchanges" + options, + "qpid-config queues" + options, + "qpid-config exchanges -b" + options, # applies to pre-0.18 vers. + "qpid-config queues -b" + options, # applies to pre-0.18 versions + "qpid-config exchanges -r" + options, # applies since 0.18 version + "qpid-config queues -r" + options, # applies since 0.18 version + "qpid-route link list" + options, + "qpid-route route list" + options, + "qpid-cluster" + options, # applies to pre-0.22 versions + "qpid-ha query" + options, # applies since 0.22 version "ls -lanR /var/lib/qpidd" ]) -- cgit