diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2014-01-31 15:08:28 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-01-31 15:08:28 +0000 |
commit | 4ab4b086c1011997246c40d4c97079c3c001031c (patch) | |
tree | f9c7b0e1664f0ad138dc6e66e1ecd0e12673910c | |
parent | 9ce854d4925b54e829836af3905ee4424935d249 (diff) | |
download | sos-4ab4b086c1011997246c40d4c97079c3c001031c.tar.gz |
Fix cluster module crm_report support
The cluster plugin used an obsolete sos-2.2 method to determine
the command output directory. This causes an excaption at runtime
since the referenced properties no longer exist.
The crm_report script also expects a --from date and will not
collect data unless this is passed. Default to passing a value 72
hours before the current time and add a 'crm_from' option to the
cluster module to allow the user to override this.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/cluster.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/sos/plugins/cluster.py b/sos/plugins/cluster.py index 50e0e0bd..c2ce42b2 100644 --- a/sos/plugins/cluster.py +++ b/sos/plugins/cluster.py @@ -13,16 +13,17 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. from sos.plugins import Plugin, RedHatPlugin -import re +import re, os from glob import glob +from datetime import datetime, timedelta class Cluster(Plugin, RedHatPlugin): """cluster suite and GFS related information """ plugin_name = 'cluster' - option_list = [("gfslockdump", - 'gather output of gfs lockdumps', 'slow', False), + option_list = [("gfslockdump", 'gather output of gfs lockdumps', 'slow', False), + ("crm_from", 'specify the --from parameter passed to crm_report', 'fast', False), ('lockdump', 'gather dlm lockdumps', 'slow', False)] packages = [ @@ -83,9 +84,21 @@ class Cluster(Plugin, RedHatPlugin): self.add_cmd_output("dlm_tool dump") self.add_cmd_output("dlm_tool ls -n") self.add_cmd_output("mkqdisk -L") - crm_dest = os.path.join(self.cInfo['cmddir'], - self.name(), 'crm_report') - self.collectExtOutput("crm_report -S --dest %s" % crm_dest) + # crm_report needs to be given a --from "YYYY-MM-DD HH:MM:SS" start + # time in order to collect data. + crm_from = (datetime.today() + - timedelta(hours=72)).strftime("%Y-%m-%d %H:%m:%S") + if self.get_option('crm_from') != False: + if re.match(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}', + str(self.getOption('crm_from'))): + crm_from = self.getOption('crm_from') + else: + self.soslog.error("crm_from parameter '%s' is not a valid date" + % self.getOption('crm_from')) + + crm_dest = os.path.join(self.get_cmd_dir(), 'crm_report') + self.add_cmd_output('crm_report -S -d --dest %s --from "%s"' + % (crm_dest, crm_from)) def do_lockdump(self): status, output, time = self.call_ext_prog("dlm_tool ls") @@ -106,8 +119,6 @@ class Cluster(Plugin, RedHatPlugin): self.do_file_sub(cluster_conf, r"(\s*\<fencedevice\s*.*\s*passwd\s*=\s*)\S+(\")", r"\1%s" %('"***"')) - for luci_cfg in glob("/var/lib/luci/etc/*.ini*"): - self.do_file_sub(luci_cfg, r"(.*secret\s*=\s*)\S+", r"\1******") self.do_cmd_output_sub("corosync-objctl", r"(.*fence.*\.passwd=)(.*)", r"\1******") |