From 357c15c273de52cc39830713c207c086adc9d211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georg=20Sch=C3=B6nberger?= Date: Fri, 19 Sep 2014 14:42:43 +0200 Subject: [PATCH] Fix ld name --- check_lsi_raid | 63 +++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/check_lsi_raid b/check_lsi_raid index c644766..d6c8069 100755 --- a/check_lsi_raid +++ b/check_lsi_raid @@ -383,7 +383,7 @@ sub getLogicalDeviceStatus { my $currBlock; foreach my $line(@output){ my @splittedLine; - if($line =~ /^\/c[0-9]*\/v([0-9]*.*)/){ + if($line =~ /^\/(c[0-9]*\/v[0-9]*).*/){ $currBlock = $1; next; } @@ -392,7 +392,6 @@ sub getLogicalDeviceStatus { @splittedLine = map { s/^\s*//; s/\s*$//; $_; } split(/\s+/,$line); my %lineValues_h; # The current block is the c0/v0 name - $currBlock =~ /\w+/; $lineValues_h{'ld'} = $currBlock; for(my $i = 0; $i < @ldmap_a; $i++){ $lineValues_h{$ldmap_a[$i]} = $splittedLine[$i]; @@ -936,16 +935,16 @@ MAIN: { } } # Prepare storcli command - $storcli .= "/c$controller"; + $storcli .= " /c$controller"; # Input validation #FIXME Replace with storcli show ctrlcount - my @controllerVersion = `$sudo $storcli /c$controller show all`; - if($controllerVersion[2] eq "Description = Controller $controller not found\n") { - print "Invalid controller number, device not found!\n"; - exit(STATE_UNKNOWN); - } +# my @controllerVersion = `$storcli /c$controller show all`; +# if($controllerVersion[2] eq "Description = Controller $controller not found\n") { +# print "Invalid controller number, device not found!\n"; +# exit(STATE_UNKNOWN); +# } if(($bbu != 1) && ($bbu != 0)) { print "Invalid BBU/CV parameter, must be 0 or 1!\n"; exit(STATE_UNKNOWN); @@ -974,31 +973,31 @@ MAIN: { my $exitstatus = 0; my $newexitstatus = 0; my $newstatusMessage = ''; - ($newexitstatus, $statusMessage) = getControllerStatus($sudo, $storcli, $controller, \@temperature_w, \@temperature_c); - $newstatusMessage .= $statusMessage; +# ($newexitstatus, $statusMessage) = getControllerStatus($sudo, $storcli, $controller, \@temperature_w, \@temperature_c); +# $newstatusMessage .= $statusMessage; +# $exitstatus = getExitState($newexitstatus, $exitstatus); +# my ($bbuPresent,$cvPresent) = (0,0); +# if($bbu == 1){ +# ($bbuPresent,$cvPresent) = checkBBUorCVIsPresent($sudo, $storcli, $controller); +# if($bbuPresent == 0 && $cvPresent == 0){ +# $exitstatus = getExitState(STATE_CRITICAL, $exitstatus); +# $newstatusMessage .= "No BBU or CV found, "; +# } +# } +# if($bbuPresent == 1){ +# ($newexitstatus, $statusMessage) = getBBUStatus($sudo, $storcli, $controller); +# $newstatusMessage .= $statusMessage; +# $exitstatus = getExitState($newexitstatus, $exitstatus); +# } +# if($cvPresent == 1){ +# ($newexitstatus, $statusMessage) = getCVStatus($sudo, $storcli, $controller); +# $newstatusMessage .= $statusMessage; +# $exitstatus = getExitState($newexitstatus, $exitstatus); +# } +# ($newexitstatus, $statusMessage) = getLogicalDeviceStatus($sudo, $storcli, $controller, \@logDevices, "init"); +# $newstatusMessage .= $statusMessage; $exitstatus = getExitState($newexitstatus, $exitstatus); - my ($bbuPresent,$cvPresent) = (0,0); - if($bbu == 1){ - ($bbuPresent,$cvPresent) = checkBBUorCVIsPresent($sudo, $storcli, $controller); - if($bbuPresent == 0 && $cvPresent == 0){ - $exitstatus = getExitState(STATE_CRITICAL, $exitstatus); - $newstatusMessage .= "No BBU or CV found, "; - } - } - if($bbuPresent == 1){ - ($newexitstatus, $statusMessage) = getBBUStatus($sudo, $storcli, $controller); - $newstatusMessage .= $statusMessage; - $exitstatus = getExitState($newexitstatus, $exitstatus); - } - if($cvPresent == 1){ - ($newexitstatus, $statusMessage) = getCVStatus($sudo, $storcli, $controller); - $newstatusMessage .= $statusMessage; - $exitstatus = getExitState($newexitstatus, $exitstatus); - } - ($newexitstatus, $statusMessage) = getLogicalDeviceStatus($sudo, $storcli, $controller, \@logDevices, "init"); - $newstatusMessage .= $statusMessage; - $exitstatus = getExitState($newexitstatus, $exitstatus); - ($newexitstatus, $statusMessage) = getLogicalDeviceStatus($sudo, $storcli, $controller, \@logDevices, "all"); + ($newexitstatus, $statusMessage) = getLogicalDeviceStatus($storcli, \@logDevices, "all"); $newstatusMessage .= $statusMessage; $exitstatus = getExitState($newexitstatus, $exitstatus); ($newexitstatus, $statusMessage) = getPhysDeviceStatus($sudo, $storcli, $controller, \@enclosures, \@physDevices, \@physicalDeviceTemperature_w, \@physicalDeviceTemperature_c, "initialization");