From fcb2cb55f53a17faf5c33547e932847b1cb12927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georg=20Sch=C3=B6nberger?= Date: Mon, 29 Sep 2014 13:57:44 +0200 Subject: [PATCH] Fix PD init and rebuild parsing --- check_lsi_raid | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/check_lsi_raid b/check_lsi_raid index 1adf282..ee23b27 100755 --- a/check_lsi_raid +++ b/check_lsi_raid @@ -428,11 +428,11 @@ sub getLogicalDevices{ # Returns information about: # - Physical device status -sub getPhysDeviceStatus { - my $storcli = $_[0]; - my @enclosures = @{($_[1])}; - my @physDevices = @{($_[2])}; - my $action = $_[5]; +sub getPhysicalDevices{ + my $storcli = shift; + my @enclosures = @{(shift)}; + my @physDevices = @{(shift)}; + my $action = shift; my $command = $storcli; if(!$NOENCLOSURES){ @@ -513,8 +513,8 @@ sub getPhysDeviceStatus { my $key; if($action eq 'rebuild'){ $key = 'rebuild'; } if($action eq 'initialization'){ $key = 'init'; } - $lineValues_h{'pd'} = $vals[0]; - $lineValues_h{$key} = $vals[2]; + $lineValues_h{'pd'} = substr($vals[0], 1); + $lineValues_h{$key} = $vals[1]; push @foundDevs, \%lineValues_h; } } @@ -871,9 +871,9 @@ MAIN: { my $LDDevicesToCheck = getLogicalDevices($storcli, \@logDevices, 'all'); my $LDInitToCheck = getLogicalDevices($storcli, \@logDevices, 'init'); - my $PDDevicesToCheck = getLogicalDevices($storcli, \@logDevices, 'all'); - my $PDInitToCheck = getLogicalDevices($storcli, \@logDevices, 'initialization'); - my $PDRebuildToCheck = getLogicalDevices($storcli, \@logDevices, 'rebuild'); + my $PDDevicesToCheck = getPhysicalDevices($storcli, \@enclosures, \@physDevices, 'all'); + my $PDInitToCheck = getPhysicalDevices($storcli, \@enclosures, \@physDevices, 'initialization'); + my $PDRebuildToCheck = getPhysicalDevices($storcli, \@enclosures, \@physDevices, 'rebuild'); $exitCode = STATE_OK; if($statusLevel_a[0] eq "Critical"){