commit 6b6c20c309af96da3fe239eb00cca549cb8e45b9 Author: Bryn M. Reeves Date: Thu Jan 9 17:32:06 2014 +0000 Pass --from argument to crm_report script The crm_report script 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. diff --git a/sos/plugins/cluster.py b/sos/plugins/cluster.py index aef5879..8c6d880 100644 --- a/sos/plugins/cluster.py +++ b/sos/plugins/cluster.py @@ -15,12 +15,14 @@ import sos.plugintools import os, re from glob import glob +from datetime import datetime, timedelta class cluster(sos.plugintools.PluginBase): """cluster suite and GFS related information """ optionList = [("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)] def checkenabled(self): @@ -98,8 +100,20 @@ class cluster(sos.plugintools.PluginBase): self.collectExtOutput("fence_tool dump") self.collectExtOutput("dlm_tool dump") self.collectExtOutput("dlm_tool ls -n") + # 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.getOption('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.cInfo['cmddir'], 'cluster', 'crm_report') - self.collectExtOutput("crm_report -S --dest %s" % crm_dest) + self.collectExtOutput('crm_report -S -d --dest %s --from "%s"' + % (crm_dest, crm_from)) def do_lockdump(self): rhelver = self.policy().rhelVersion()