From: Dan Mick Date: Tue, 8 Sep 2015 21:23:01 +0000 (-0700) Subject: smart.pl multiline mode: show failed/missing drives as well X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=bae51d0cb809e8604b01ee7fc2af6b869da6c58d;p=ceph-cm-ansible.git smart.pl multiline mode: show failed/missing drives as well also, make a global "multiline" flag (since it's now being used in multiple places) Signed-off-by: Dan Mick --- diff --git a/roles/testnode/files/libexec/smart.pl b/roles/testnode/files/libexec/smart.pl index 7a82686..9c4e03e 100644 --- a/roles/testnode/files/libexec/smart.pl +++ b/roles/testnode/files/libexec/smart.pl @@ -16,6 +16,7 @@ my $type; my $mdadm; my $fullcommand; my $message; +my $multiline; my $hostname = `uname -n`; chomp $hostname; @@ -28,6 +29,10 @@ our $realloc = '50'; our $pend = '1'; our $uncorrect = '1'; +if ($ARGV[0] =~ /-m/) { + $multiline = 1; +} + if ( $hostname =~ /mira/i ) { $realloc = '200'; @@ -188,7 +193,12 @@ if ( $pci =~ /areca/i) $sgindex++; } my $scsidev = "/dev/sg$sgindex"; - open(CLI,"sudo /usr/sbin/cli64 disk info | grep -vi Modelname | grep -v ====== | grep -vi GuiErr | grep -vi Free | grep -vi Failed | grep -vi 'N.A.' |"); + if ($multiline) { + # don't filter out Failed/N.A drives + open(CLI,"sudo /usr/sbin/cli64 disk info | grep -vi Modelname | grep -v ====== | grep -vi GuiErr |"); + } else { + open(CLI,"sudo /usr/sbin/cli64 disk info | grep -vi Modelname | grep -v ====== | grep -vi GuiErr | grep -vi Free | grep -vi Failed | grep -vi 'N.A.' |"); + } while () { $drives++; @@ -198,7 +208,12 @@ if ( $pci =~ /areca/i) foreach ($info[1]) { my $drive = $_; - smartctl("$smartctl","areca",$drive,$scsidev); + my $status = $info[$#info]; + if ($multiline && ($status =~ /Failed/ || $status =~ /N\.A\./)) { + push(@out, "Drive $drive $status"); + } else { + smartctl("$smartctl","areca",$drive,$scsidev); + } } } }