thomas-krenn / check_lsi_raid

Monitoring plugin to check MegaRAID controllers
GNU General Public License v3.0
59 stars 26 forks source link

storcli parsing issues (missing ROC_Temperature and other things) #31

Closed TobbeJ closed 3 years ago

TobbeJ commented 3 years ago

Just found that this script is still got some stuff that's not working properly. for example controller temperature is missing and no data at all if you do -vvv regarding the controller itself.

below patch fixes it for me

diff --git a/check_lsi_raid b/check_lsi_raid
index 087859d..fd89e20 100755
--- a/check_lsi_raid
+++ b/check_lsi_raid
@@ -234,7 +234,7 @@ sub getControllerInfo{
        my $command = '';

        $storcli =~ /^(.*)\/c[0-9]+/;
-       $command = $1.'/c'.$CONTROLLER.' show';
+       $command = $1.'/c'.$CONTROLLER.' show all';

        push @{$commands_a}, $command;
        my @output = `$command`;
@@ -244,8 +244,8 @@ sub getControllerInfo{
        }
        my %foundController_h;
        foreach my $line(@output){
-               if($line =~ /\:/){
-                       my @lineVals = split(':', $line);
+               if($line =~ /\=/){
+                       my @lineVals = split('=', $line);
                        $lineVals[0] =~ s/^\s+|\s+$//g;
                        $lineVals[1] =~ s/^\s+|\s+$//g;
                        $foundController_h{$lineVals[0]} = $lineVals[1];
@@ -264,7 +264,7 @@ sub getControllerStatus{
        my %foundController = %{(shift)};
        my $status = '';
        foreach my $key (%foundController){
-               if($key eq 'ROC temperature'){
+               if($key eq 'ROC temperature(Degree Celsius)'){
                        $foundController{$key} =~ /^([0-9]+\.?[0-9]+).*$/;
                        if(defined($1)){
                                if(!(checkThreshs($1, $C_TEMP_CRITICAL))){
@@ -1119,13 +1119,13 @@ sub getVerboseString{
        }
        if($VERBOSITY == 3){
                $verb_str .= "CTR information:\n";
-               $verb_str .= "\t- ".$controllerToCheck{'Product Name'}.":\n";
-               $verb_str .= "\t\t- ".'Serial No='.$controllerToCheck{'Serial No'}."\n";
-               $verb_str .= "\t\t- ".'FW Package Build='.$controllerToCheck{'FW Package Build'}."\n";
-               $verb_str .= "\t\t- ".'Mfg. Date='.$controllerToCheck{'Mfg. Date'}."\n";
+               $verb_str .= "\t- ".$controllerToCheck{'Model'}.":\n";
+               $verb_str .= "\t\t- ".'Serial Number='.$controllerToCheck{'Serial Number'}."\n";
+               $verb_str .= "\t\t- ".'Firmware Package Build='.$controllerToCheck{'Firmware Package Build'}."\n";
+               $verb_str .= "\t\t- ".'Mfg Date='.$controllerToCheck{'Mfg Date'}."\n";
                $verb_str .= "\t\t- ".'Revision No='.$controllerToCheck{'Revision No'}."\n";
-               $verb_str .= "\t\t- ".'BIOS Version='.$controllerToCheck{'BIOS Version'}."\n";
-               $verb_str .= "\t\t- ".'FW Version='.$controllerToCheck{'FW Version'}."\n";
+               $verb_str .= "\t\t- ".'Bios Version='.$controllerToCheck{'Bios Version'}."\n";
+               $verb_str .= "\t\t- ".'Firmware Version='.$controllerToCheck{'Firmware Version'}."\n";
                if(exists($controllerToCheck{'ROC temperature'})){
                        $verb_str .= "\t\t- ".'ROC temperature='.$controllerToCheck{'ROC temperature'}."\n";
                }
gschoenberger commented 3 years ago

Your are right, tested this patch with storcli Ver 007.1508.0000.0000 Thanks!

gschoenberger commented 3 years ago

Fixed by 32075f62ef6c197b148aed3d25e0291f705e99e0