From 95f5fd634e9d5e373816a56352f41c0cfb2f7399 Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Tue, 31 Jul 2018 21:08:13 -0400 Subject: [megacli] Correct MegaCli commands and enablement The MegaCli64 command needs to be called using the full path to the binary. Also, correct the -ShowSummary adapter argument. Additionally, use the builtin 'files' check to enable the plugin only if the binary exists. Closes: #403 Resolves: #1392 Signed-off-by: Jake Hunsaker Signed-off-by: Bryn M. Reeves --- sos/plugins/megacli.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/sos/plugins/megacli.py b/sos/plugins/megacli.py index 34d3be8e..f29aa830 100644 --- a/sos/plugins/megacli.py +++ b/sos/plugins/megacli.py @@ -9,8 +9,6 @@ # # See the LICENSE file in the source distribution for further information. -import os -import os.path from sos.plugins import Plugin, RedHatPlugin @@ -20,21 +18,19 @@ class MegaCLI(Plugin, RedHatPlugin): plugin_name = 'megacli' profiles = ('system', 'storage', 'hardware') + files = ('/opt/MegaRAID/MegaCli/MegaCli64',) def setup(self): - if os.path.isfile("/opt/MegaRAID/MegaCli/MegaCli64"): - self.add_custom_text("LSI MegaCLI is installed.
") - self.get_megacli_files() - - def get_megacli_files(self): - """ MegaCLI specific output - """ + cmd = '/opt/MegaRAID/MegaCli/MegaCli64' + subcmds = [ + 'LDPDInfo', + '-AdpAllInfo', + '-AdpBbuCmd -GetBbuStatus', + '-ShowSummary' + ] self.add_cmd_output([ - "MegaCli64 LDPDInfo -aALL", - "MegaCli64 -AdpAllInfo -aALL", - "MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL", - "MegaCli64 -ShowSummary -a0" + "%s %s -aALL" % (cmd, subcmd) for subcmd in subcmds ]) # vim: set et ts=4 sw=4 : -- cgit