From 178174c85f85e108b6637148e418443e0a32f32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georg=20Sch=C3=B6nberger?= Date: Mon, 29 Sep 2014 11:07:08 +0200 Subject: [PATCH] Check for correct controller number --- check_lsi_raid | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/check_lsi_raid b/check_lsi_raid index 1a49e2d..bc27579 100755 --- a/check_lsi_raid +++ b/check_lsi_raid @@ -145,6 +145,13 @@ sub checkCommandStatus{ } } +sub getControllerTime{ + my $storcli = shift; + my $ctr = shift; + my @output = `$storcli show time`; + return (checkCommandStatus(\@output)); +} + # Returns information about: # - Controller status and controller temperature sub getControllerStatus { @@ -812,15 +819,10 @@ MAIN: { if(defined($version)){ displayVersion($storcli) } # Prepare storcli command $storcli .= " /c$controller"; - - - # Input validation - #FIXME Replace with storcli show ctrlcount -# 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(!getControllerTime($storcli)){ + 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);