mirror of
https://github.com/thomas-krenn/check_lsi_raid.git
synced 2025-07-14 03:41:50 +02:00
Rewrite given/when to if/elsif
-Added eclipse project files -Remove tmp POD files
This commit is contained in:
3
.includepath
Normal file
3
.includepath
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<includepath />
|
||||||
|
|
17
.project
Normal file
17
.project
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>check_lsi_raid</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.epic.perleditor.perlbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.epic.perleditor.perlnature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
708
check_lsi_raid
708
check_lsi_raid
@ -15,20 +15,18 @@
|
|||||||
# the terms of the GNU General Public License as published by the Free Software
|
# the terms of the GNU General Public License as published by the Free Software
|
||||||
# Foundation; either version 3 of the License, or (at your option) any later
|
# Foundation; either version 3 of the License, or (at your option) any later
|
||||||
# version.
|
# version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
# details.
|
# details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License along with
|
# You should have received a copy of the GNU General Public License along with
|
||||||
# this program; if not, see <http://www.gnu.org/licenses/>.
|
# this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
# ======================================================================================
|
# ======================================================================================
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Getopt::Long qw(:config no_ignore_case);
|
use Getopt::Long qw(:config no_ignore_case);
|
||||||
use feature qw/switch/; #sp<73>ter durch nachfolgende Zeile ersetzen, da wir noch mit Perl 5 arbeiten!
|
|
||||||
#use Switch 'Perl6';
|
|
||||||
|
|
||||||
our $VERBOSITY = 0;
|
our $VERBOSITY = 0;
|
||||||
our $VERSION = "0.3";
|
our $VERSION = "0.3";
|
||||||
@ -38,7 +36,7 @@ our $C_TEMP_CRITICAL = 65;
|
|||||||
our $PD_TEMP_WARNING = 40;
|
our $PD_TEMP_WARNING = 40;
|
||||||
our $PD_TEMP_CRITICAL = 45;
|
our $PD_TEMP_CRITICAL = 45;
|
||||||
|
|
||||||
use constant {
|
use constant {
|
||||||
STATE_OK => 0,
|
STATE_OK => 0,
|
||||||
STATE_WARNING => 1,
|
STATE_WARNING => 1,
|
||||||
STATE_CRITICAL => 2,
|
STATE_CRITICAL => 2,
|
||||||
@ -86,18 +84,21 @@ sub displayUsage {
|
|||||||
sub displayHelp {
|
sub displayHelp {
|
||||||
print $NAME . " Version: " . $VERSION ."\n";
|
print $NAME . " Version: " . $VERSION ."\n";
|
||||||
print "Copyright (C) 2009-2013 Thomas-Krenn.AG\n";
|
print "Copyright (C) 2009-2013 Thomas-Krenn.AG\n";
|
||||||
print "Current updates available at http://www.thomas-krenn.com/en/oss/<NOT HERE YET!!!!!!>/\n";
|
print "Current updates available at http://git.thomas-krenn.com/check_lsi_raid.git\n";
|
||||||
print "This Nagios/Icinga Plugin checks LSI RAID-Controllers for Controller, \nPhysical-Device and Logical Device warnings and errors.\n";
|
print "This Nagios/Icinga Plugin checks LSI RAID-Controllers for Controller, \nPhysical-Device and Logical Device warnings and errors.\n";
|
||||||
print "In order for this plugin to work properly you need to add the \nnagios-user to your sudoers file (or create a new one in /etc/sudoers.d/)\n";
|
print "In order for this plugin to work properly you need to add the \nnagios-user to your sudoers file (or create a new one in /etc/sudoers.d/)\n";
|
||||||
displayUsage();
|
displayUsage();
|
||||||
print "Further information about this plugin can be found at
|
print "Further information about this plugin can be found at:
|
||||||
http://www.thomas-krenn.com/en/oss/<NOT THERE YET!>
|
http://www.thomas-krenn.com/de/wiki/LSI_RAID_Monitoring_Plugin and
|
||||||
Send email to the <NOT THERE YET!>-plugin-user mailing list if you have questions regarding
|
http://www.thomas-krenn.com/de/wiki/LSI_RAID_Monitoring_Plugin
|
||||||
use of this software, to submit patches, or suggest improvements.
|
Please send an email to the tk-monitoring plugin-user mailing list:
|
||||||
The mailing list is available at http://lists.thomas-krenn.com/\n";
|
tk-monitoring-plugins-user\@lists.thomas-krenn.com
|
||||||
|
if you have questions regarding use of this software, to submit patches, or
|
||||||
|
suggest improvements. The mailing list archive is available at:
|
||||||
|
http://lists.thomas-krenn.com/pipermail/tk-monitoring-plugins-user\n";
|
||||||
exit(STATE_OK);
|
exit(STATE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Prints the Name, Version of the Plugin
|
# Prints the Name, Version of the Plugin
|
||||||
# Also Prints the version of StorCLI
|
# Also Prints the version of StorCLI
|
||||||
sub displayVersion {
|
sub displayVersion {
|
||||||
@ -140,188 +141,182 @@ sub getControllerStatus {
|
|||||||
$first = $1;
|
$first = $1;
|
||||||
if($line =~ /([a-zA-Z0-9]*)$/) {
|
if($line =~ /([a-zA-Z0-9]*)$/) {
|
||||||
$last = $1;
|
$last = $1;
|
||||||
given($first) {
|
if($first eq "Controller") {
|
||||||
when("Controller") {
|
if($line =~ /\s+([a-zA-Z0-9]*)/) {
|
||||||
if($line =~ /\s+([a-zA-Z0-9]*)/) {
|
if($1 eq "Status") {
|
||||||
given($1) {
|
if($last ne "OK") {
|
||||||
when("Status") {
|
$status = getExitState($status, STATE_WARNING);
|
||||||
if($last ne "OK") {
|
$statusMessage .= "Ctrl. status not optimal, ";
|
||||||
$status = getExitState($status, STATE_WARNING);
|
}
|
||||||
$statusMessage .= "Ctrl. status not optimal, ";
|
}
|
||||||
}
|
elsif($1 eq "must") {
|
||||||
}
|
if($last ne "No") {
|
||||||
when("must") {
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
if($last ne "No") {
|
$statusMessage .= "Ctrl. needs reboot, ";
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
}
|
||||||
$statusMessage .= "Ctrl. needs reboot, ";
|
}
|
||||||
}
|
elsif($1 eq "has") {
|
||||||
}
|
if($last ne "No") {
|
||||||
when("has") {
|
$status = getExitState($status, STATE_WARNING);
|
||||||
if($last ne "No") {
|
$statusMessage .= "Ctrl. booted in safe mode, ";
|
||||||
$status = getExitState($status, STATE_WARNING);
|
}
|
||||||
$statusMessage .= "Ctrl. booted in safe mode, ";
|
}
|
||||||
}
|
elsif($1 eq "temperature") {
|
||||||
}
|
$temp = $last;
|
||||||
when("temperature") {
|
if($temperature_w[0] eq "in") {
|
||||||
$temp = $last;
|
if(($temp >= $temperature_w[1]) && ($temp <= $temperature_w[2])) {
|
||||||
if($temperature_w[0] eq "in") {
|
# is in warn range, so also check if in critical error range
|
||||||
if(($temp >= $temperature_w[1]) && ($temp <= $temperature_w[2])) {
|
if($temperature_c[0] eq "in") {
|
||||||
# is in warn range, so also check if in critical error range
|
if(($temp >= $temperature_c[1]) && ($temp <= $temperature_c[2])) {
|
||||||
if($temperature_c[0] eq "in") {
|
# critical error
|
||||||
if(($temp >= $temperature_c[1]) && ($temp <= $temperature_c[2])) {
|
$crit = 1;
|
||||||
# critical error
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
$crit = 1;
|
if ($VERBOSITY == 0) {$statusMessage .= "Ctrl. temp. critical, "; }
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
if ($VERBOSITY == 1) {$statusMessage .= "Ctrl. temp. is critical (${temp}C), "; }
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Ctrl. temp. critical, "; }
|
if ($VERBOSITY >= 2) {$statusMessage .= "Controller temperature is critical (${temp}C), "; }
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Ctrl. temp. is critical (${temp}C), "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Controller temperature is critical (${temp}C), "; }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(($temp < $temperature_c[1]) || ($temp > $temperature_c[2])) {
|
|
||||||
# critical error
|
|
||||||
$crit = 1;
|
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Ctrl. temp. critical, "; }
|
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Ctrl. temp. is critical (${temp}C), "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Controller temperature is critical (${temp}C), "; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($crit eq 0) { # only warn if not already given a critical error
|
|
||||||
$status = getExitState($status, STATE_WARNING);
|
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Ctrl. temp. warning, "; }
|
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Ctrl. temp. warning (${temp}C), "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Controller temperature warning (${temp}C), "; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(($temp < $temperature_w[1]) || ($temp > $temperature_w[2])) {
|
if(($temp < $temperature_c[1]) || ($temp > $temperature_c[2])) {
|
||||||
# is in warn range, so also check if in critical error range
|
# critical error
|
||||||
if($temperature_c[0] eq "in") {
|
$crit = 1;
|
||||||
if(($temp >= $temperature_c[1]) && ($temp <= $temperature_c[2])) {
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
# critical error
|
if ($VERBOSITY == 0) {$statusMessage .= "Ctrl. temp. critical, "; }
|
||||||
$crit = 1;
|
if ($VERBOSITY == 1) {$statusMessage .= "Ctrl. temp. is critical (${temp}C), "; }
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
if ($VERBOSITY >= 2) {$statusMessage .= "Controller temperature is critical (${temp}C), "; }
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Ctrl. temp. critical, "; }
|
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Ctrl. temp. is critical (${temp}C), "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Controller temperature is critical (${temp}C), "; }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(($temp < $temperature_c[1]) || ($temp > $temperature_c[2])) {
|
|
||||||
# critical error
|
|
||||||
$crit = 1;
|
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Ctrl. temp. critical, "; }
|
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Ctrl. temp. is critical (${temp}C), "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Controller temperature is critical (${temp}C), "; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($crit eq 0) { # only warn if not already given a critical error
|
|
||||||
$status = getExitState($status, STATE_WARNING);
|
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Ctrl. temp. warning, "; }
|
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Ctrl. temp. warning (${temp}C), "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Controller temperature warning (${temp}C), "; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if($crit eq 0) { # only warn if not already given a critical error
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
when("ROC") {
|
|
||||||
if($line =~ /\s+([a-zA-Z0-9]*)/) {
|
|
||||||
if($1 eq "temperature") {
|
|
||||||
$temp = $last;
|
|
||||||
if($temperature_w[0] eq "in") {
|
|
||||||
if(($temp >= $temperature_w[1]) && ($temp <= $temperature_w[2])) {
|
|
||||||
# is in warn range, so also check if in critical error range
|
|
||||||
if($temperature_c[0] eq "in") {
|
|
||||||
if(($temp >= $temperature_c[1]) && ($temp <= $temperature_c[2])) {
|
|
||||||
# critical error
|
|
||||||
$crit = 1;
|
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "ROC temp. critical, "; }
|
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "ROC temp. is critical (${temp}C), "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "ROC temperature is critical (${temp}C), "; }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(($temp < $temperature_c[1]) || ($temp > $temperature_c[2])) {
|
|
||||||
# critical error
|
|
||||||
$crit = 1;
|
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "ROC temp. critical, "; }
|
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "ROC temp. is critical (${temp}C), "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "ROC temperature is critical (${temp}C), "; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($crit eq 0) { # only warn if not already given a critical error
|
|
||||||
$status = getExitState($status, STATE_WARNING);
|
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "ROC temp. warning, "; }
|
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "ROC temp. warning (${temp}C), "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "ROC temperature warning (${temp}C), "; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(($temp < $temperature_w[1]) || ($temp > $temperature_w[2])) {
|
|
||||||
# is in warn range, so also check if in critical error range
|
|
||||||
if($temperature_c[0] eq "in") {
|
|
||||||
if(($temp >= $temperature_c[1]) && ($temp <= $temperature_c[2])) {
|
|
||||||
# critical error
|
|
||||||
$crit = 1;
|
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "ROC temp. critical, "; }
|
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "ROC temp. is critical (${temp}C), "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "ROC temperature is critical (${temp}C), "; }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(($temp < $temperature_c[1]) || ($temp > $temperature_c[2])) {
|
|
||||||
# critical error
|
|
||||||
$crit = 1;
|
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "ROC temp. critical, "; }
|
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "ROC temp. is critical (${temp}C), "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "ROC temperature is critical (${temp}C), "; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($crit eq 0) { # only warn if not already given a critical error
|
|
||||||
$status = getExitState($status, STATE_WARNING);
|
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "ROC temp. warning, "; }
|
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "ROC temp. warning (${temp}C), "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "ROC temperature warning (${temp}C), "; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
when("Memory") {
|
|
||||||
if($line =~ /(\s+[a-zA-Z0-9]*)/) {
|
|
||||||
given($1) {
|
|
||||||
when("Correctable") {
|
|
||||||
if($last ne "0") {
|
|
||||||
$status = getExitState($status, STATE_WARNING);
|
$status = getExitState($status, STATE_WARNING);
|
||||||
$statusMessage .= "Memory correctable errors detected, ";
|
if ($VERBOSITY == 0) {$statusMessage .= "Ctrl. temp. warning, "; }
|
||||||
|
if ($VERBOSITY == 1) {$statusMessage .= "Ctrl. temp. warning (${temp}C), "; }
|
||||||
|
if ($VERBOSITY >= 2) {$statusMessage .= "Controller temperature warning (${temp}C), "; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when("Uncorrectable") {
|
} else {
|
||||||
if($last ne "0") {
|
if(($temp < $temperature_w[1]) || ($temp > $temperature_w[2])) {
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
# is in warn range, so also check if in critical error range
|
||||||
$statusMessage .= "Memory uncorrectable errors detected, ";
|
if($temperature_c[0] eq "in") {
|
||||||
|
if(($temp >= $temperature_c[1]) && ($temp <= $temperature_c[2])) {
|
||||||
|
# critical error
|
||||||
|
$crit = 1;
|
||||||
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
|
if ($VERBOSITY == 0) {$statusMessage .= "Ctrl. temp. critical, "; }
|
||||||
|
if ($VERBOSITY == 1) {$statusMessage .= "Ctrl. temp. is critical (${temp}C), "; }
|
||||||
|
if ($VERBOSITY >= 2) {$statusMessage .= "Controller temperature is critical (${temp}C), "; }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(($temp < $temperature_c[1]) || ($temp > $temperature_c[2])) {
|
||||||
|
# critical error
|
||||||
|
$crit = 1;
|
||||||
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
|
if ($VERBOSITY == 0) {$statusMessage .= "Ctrl. temp. critical, "; }
|
||||||
|
if ($VERBOSITY == 1) {$statusMessage .= "Ctrl. temp. is critical (${temp}C), "; }
|
||||||
|
if ($VERBOSITY >= 2) {$statusMessage .= "Controller temperature is critical (${temp}C), "; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($crit eq 0) { # only warn if not already given a critical error
|
||||||
|
$status = getExitState($status, STATE_WARNING);
|
||||||
|
if ($VERBOSITY == 0) {$statusMessage .= "Ctrl. temp. warning, "; }
|
||||||
|
if ($VERBOSITY == 1) {$statusMessage .= "Ctrl. temp. warning (${temp}C), "; }
|
||||||
|
if ($VERBOSITY >= 2) {$statusMessage .= "Controller temperature warning (${temp}C), "; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when("Failed") {
|
}
|
||||||
if($last ne "No") {
|
elsif($first eq "ROC") {
|
||||||
$status = getExitState($status, STATE_WARNING);
|
if($line =~ /\s+([a-zA-Z0-9]*)/) {
|
||||||
$statusMessage .= "Failed to get lock key on bootup, ";
|
if($1 eq "temperature") {
|
||||||
|
$temp = $last;
|
||||||
|
if($temperature_w[0] eq "in") {
|
||||||
|
if(($temp >= $temperature_w[1]) && ($temp <= $temperature_w[2])) {
|
||||||
|
# is in warn range, so also check if in critical error range
|
||||||
|
if($temperature_c[0] eq "in") {
|
||||||
|
if(($temp >= $temperature_c[1]) && ($temp <= $temperature_c[2])) {
|
||||||
|
# critical error
|
||||||
|
$crit = 1;
|
||||||
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
|
if ($VERBOSITY == 0) {$statusMessage .= "ROC temp. critical, "; }
|
||||||
|
if ($VERBOSITY == 1) {$statusMessage .= "ROC temp. is critical (${temp}C), "; }
|
||||||
|
if ($VERBOSITY >= 2) {$statusMessage .= "ROC temperature is critical (${temp}C), "; }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(($temp < $temperature_c[1]) || ($temp > $temperature_c[2])) {
|
||||||
|
# critical error
|
||||||
|
$crit = 1;
|
||||||
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
|
if ($VERBOSITY == 0) {$statusMessage .= "ROC temp. critical, "; }
|
||||||
|
if ($VERBOSITY == 1) {$statusMessage .= "ROC temp. is critical (${temp}C), "; }
|
||||||
|
if ($VERBOSITY >= 2) {$statusMessage .= "ROC temperature is critical (${temp}C), "; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($crit eq 0) { # only warn if not already given a critical error
|
||||||
|
$status = getExitState($status, STATE_WARNING);
|
||||||
|
if ($VERBOSITY == 0) {$statusMessage .= "ROC temp. warning, "; }
|
||||||
|
if ($VERBOSITY == 1) {$statusMessage .= "ROC temp. warning (${temp}C), "; }
|
||||||
|
if ($VERBOSITY >= 2) {$statusMessage .= "ROC temperature warning (${temp}C), "; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(($temp < $temperature_w[1]) || ($temp > $temperature_w[2])) {
|
||||||
|
# is in warn range, so also check if in critical error range
|
||||||
|
if($temperature_c[0] eq "in") {
|
||||||
|
if(($temp >= $temperature_c[1]) && ($temp <= $temperature_c[2])) {
|
||||||
|
# critical error
|
||||||
|
$crit = 1;
|
||||||
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
|
if ($VERBOSITY == 0) {$statusMessage .= "ROC temp. critical, "; }
|
||||||
|
if ($VERBOSITY == 1) {$statusMessage .= "ROC temp. is critical (${temp}C), "; }
|
||||||
|
if ($VERBOSITY >= 2) {$statusMessage .= "ROC temperature is critical (${temp}C), "; }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(($temp < $temperature_c[1]) || ($temp > $temperature_c[2])) {
|
||||||
|
# critical error
|
||||||
|
$crit = 1;
|
||||||
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
|
if ($VERBOSITY == 0) {$statusMessage .= "ROC temp. critical, "; }
|
||||||
|
if ($VERBOSITY == 1) {$statusMessage .= "ROC temp. is critical (${temp}C), "; }
|
||||||
|
if ($VERBOSITY >= 2) {$statusMessage .= "ROC temperature is critical (${temp}C), "; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($crit eq 0) { # only warn if not already given a critical error
|
||||||
|
$status = getExitState($status, STATE_WARNING);
|
||||||
|
if ($VERBOSITY == 0) {$statusMessage .= "ROC temp. warning, "; }
|
||||||
|
if ($VERBOSITY == 1) {$statusMessage .= "ROC temp. warning (${temp}C), "; }
|
||||||
|
if ($VERBOSITY >= 2) {$statusMessage .= "ROC temperature warning (${temp}C), "; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when("A") {
|
}
|
||||||
if($last ne "No") {
|
elsif($first eq "Memory") {
|
||||||
$status = getExitState($status, STATE_WARNING);
|
if($line =~ /(\s+[a-zA-Z0-9]*)/) {
|
||||||
$statusMessage .= "A rollback operation is in progress, ";
|
if($1 eq "Correctable") {
|
||||||
|
if($last ne "0") {
|
||||||
|
$status = getExitState($status, STATE_WARNING);
|
||||||
|
$statusMessage .= "Memory correctable errors detected, ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
elsif($1 eq "Uncorrectable") {
|
||||||
|
if($last ne "0") {
|
||||||
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
|
$statusMessage .= "Memory uncorrectable errors detected, ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif($first eq "Failed") {
|
||||||
|
if($last ne "No") {
|
||||||
|
$status = getExitState($status, STATE_WARNING);
|
||||||
|
$statusMessage .= "Failed to get lock key on bootup, ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif($first eq "A") {
|
||||||
|
if($last ne "No") {
|
||||||
|
$status = getExitState($status, STATE_WARNING);
|
||||||
|
$statusMessage .= "A rollback operation is in progress, ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,7 +326,7 @@ sub getControllerStatus {
|
|||||||
} else {
|
} else {
|
||||||
print "Invalid StorCLI command!";
|
print "Invalid StorCLI command!";
|
||||||
exit(STATE_UNKNOWN);
|
exit(STATE_UNKNOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Returns information about:
|
# Returns information about:
|
||||||
@ -347,11 +342,10 @@ sub getLogicalDeviceStatus {
|
|||||||
my $status = 0; # Return Status
|
my $status = 0; # Return Status
|
||||||
my $statusMessage = ''; # Return String
|
my $statusMessage = ''; # Return String
|
||||||
|
|
||||||
given(scalar(@logDevices)) {
|
if(scalar(@logDevices) == 0) { $command .= "/vall"; }
|
||||||
when(0) { $command .= "/vall"; }
|
elsif(scalar(@logDevices) == 1) { $command .= "/v$logDevices[0]"; }
|
||||||
when(1) { $command .= "/v$logDevices[0]"; }
|
else { $command .= "/v".join(",", @logDevices); }
|
||||||
default { $command .= "/v".join(",", @logDevices); }
|
|
||||||
}
|
|
||||||
$command .= " show $action";
|
$command .= " show $action";
|
||||||
my @output = `$command`;
|
my @output = `$command`;
|
||||||
|
|
||||||
@ -435,19 +429,17 @@ sub getPhysDeviceStatus {
|
|||||||
my $status = 0;
|
my $status = 0;
|
||||||
my $statusMessage = '';
|
my $statusMessage = '';
|
||||||
|
|
||||||
given(scalar(@enclosures)) {
|
if(scalar(@enclosures) == 0) { $command .= "/eall"; }
|
||||||
when(0) { $command .= "/eall"; }
|
elsif(scalar(@enclosures) == 1) { $command .= "/e$enclosures[0]"; }
|
||||||
when(1) { $command .= "/e$enclosures[0]"; }
|
else { $command .= "/e".join(",", @enclosures); }
|
||||||
default { $command .= "/e".join(",", @enclosures); }
|
|
||||||
}
|
if(scalar(@physDevices) == 0) { $command .= "/sall"; }
|
||||||
given(scalar(@physDevices)) {
|
elsif(scalar(@physDevices) == 1) { $command .= "/s$physDevices[0]"; }
|
||||||
when(0) { $command .= "/sall"; }
|
else { $command .= "/s".join(",", @physDevices); }
|
||||||
when(1) { $command .= "/s$physDevices[0]"; }
|
|
||||||
default { $command .= "/s".join(",", @physDevices); }
|
|
||||||
}
|
|
||||||
$command .= " show $action";
|
$command .= " show $action";
|
||||||
my @output = `$command`;
|
my @output = `$command`;
|
||||||
|
|
||||||
if($output[1] eq "Status = Success\n") {
|
if($output[1] eq "Status = Success\n") {
|
||||||
if($action eq "all") {
|
if($action eq "all") {
|
||||||
my $output_enc = -1;
|
my $output_enc = -1;
|
||||||
@ -484,111 +476,109 @@ sub getPhysDeviceStatus {
|
|||||||
}
|
}
|
||||||
} elsif($values[0] =~ /^[a-zA-Z\.]*/) {
|
} elsif($values[0] =~ /^[a-zA-Z\.]*/) {
|
||||||
# Check the drive state in block Detailed information
|
# Check the drive state in block Detailed information
|
||||||
given($values[0]) {
|
if($values[0] eq "Shield") {
|
||||||
when("Shield") {
|
if($values[3] ne "0") {
|
||||||
if($values[3] ne "0") {
|
$status = getExitState($status, STATE_WARNING);
|
||||||
$status = getExitState($status, STATE_WARNING);
|
if ($VERBOSITY == 0) {$statusMessage .= "Shield counter (phys. drive) not 0, "; }
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Shield counter (phys. drive) not 0, "; }
|
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: shield counter not 0, "; }
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: shield counter not 0, "; }
|
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: shield counter not 0, "; }
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: shield counter not 0, "; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
when("Media") {
|
}
|
||||||
if($values[4] ne "0") {
|
elsif($values[0] eq "Media") {
|
||||||
$status = getExitState($status, STATE_WARNING);
|
if($values[4] ne "0") {
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Media error count (phys. drive) not 0, "; }
|
$status = getExitState($status, STATE_WARNING);
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: media error count not 0, "; }
|
if ($VERBOSITY == 0) {$statusMessage .= "Media error count (phys. drive) not 0, "; }
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: media error count not 0, "; }
|
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: media error count not 0, "; }
|
||||||
}
|
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: media error count not 0, "; }
|
||||||
}
|
}
|
||||||
when("Other") {
|
}
|
||||||
if($values[4] ne "0") {
|
elsif($values[0] eq "Other") {
|
||||||
$status = getExitState($status, STATE_WARNING);
|
if($values[4] ne "0") {
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Other error count (phys. drive) not 0, "; }
|
$status = getExitState($status, STATE_WARNING);
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: media error count not 0, "; }
|
if ($VERBOSITY == 0) {$statusMessage .= "Other error count (phys. drive) not 0, "; }
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: media error count not 0, "; }
|
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: media error count not 0, "; }
|
||||||
}
|
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: media error count not 0, "; }
|
||||||
}
|
}
|
||||||
when("Drive") {
|
}
|
||||||
chop($values[3]);
|
elsif($values[0] eq "Drive") {
|
||||||
my $temp = $values[3];
|
chop($values[3]);
|
||||||
my $crit = 0;
|
my $temp = $values[3];
|
||||||
# check for warn range
|
my $crit = 0;
|
||||||
if($physicalDeviceTemperature_w[0] eq "in") {
|
# check for warn range
|
||||||
if(($temp >= $physicalDeviceTemperature_w[1]) && ($temp <= $physicalDeviceTemperature_w[2])) {
|
if($physicalDeviceTemperature_w[0] eq "in") {
|
||||||
# is in warn range, so also check if in critical error range
|
if(($temp >= $physicalDeviceTemperature_w[1]) && ($temp <= $physicalDeviceTemperature_w[2])) {
|
||||||
if($physicalDeviceTemperature_c[0] eq "in") {
|
# is in warn range, so also check if in critical error range
|
||||||
if(($temp >= $physicalDeviceTemperature_c[1]) && ($temp <= $physicalDeviceTemperature_c[2])) {
|
if($physicalDeviceTemperature_c[0] eq "in") {
|
||||||
# critical error
|
if(($temp >= $physicalDeviceTemperature_c[1]) && ($temp <= $physicalDeviceTemperature_c[2])) {
|
||||||
$crit = 1;
|
# critical error
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
$crit = 1;
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive temperature critical, "; }
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: temperature is ${temp}C, "; }
|
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive temperature critical, "; }
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: temperature is ${temp}C, "; }
|
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: temperature is ${temp}C, "; }
|
||||||
}
|
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: temperature is ${temp}C, "; }
|
||||||
} else {
|
|
||||||
if(($temp < $physicalDeviceTemperature_c[1]) || ($temp > $physicalDeviceTemperature_c[2])) {
|
|
||||||
# critical error
|
|
||||||
$crit = 1;
|
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive temperature critical, "; }
|
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: temperature is ${temp}C, "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: temperature is ${temp}C, "; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if($crit eq 0) { # only warn if not already given a critical error
|
} else {
|
||||||
$status = getExitState($status, STATE_WARNING);
|
if(($temp < $physicalDeviceTemperature_c[1]) || ($temp > $physicalDeviceTemperature_c[2])) {
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive temperature warning, "; }
|
# critical error
|
||||||
|
$crit = 1;
|
||||||
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
|
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive temperature critical, "; }
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: temperature is ${temp}C, "; }
|
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: temperature is ${temp}C, "; }
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: temperature is ${temp}C, "; }
|
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: temperature is ${temp}C, "; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
if($crit eq 0) { # only warn if not already given a critical error
|
||||||
if(($temp < $physicalDeviceTemperature_w[1]) || ($temp > $physicalDeviceTemperature_w[2])) {
|
$status = getExitState($status, STATE_WARNING);
|
||||||
# is in warn range, so also check if in critical error range
|
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive temperature warning, "; }
|
||||||
if($physicalDeviceTemperature_c[0] eq "in") {
|
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: temperature is ${temp}C, "; }
|
||||||
if(($temp >= $physicalDeviceTemperature_c[1]) && ($temp <= $physicalDeviceTemperature_c[2])) {
|
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: temperature is ${temp}C, "; }
|
||||||
# critical error
|
}
|
||||||
$crit = 1;
|
}
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
} else {
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive temperature critical, "; }
|
if(($temp < $physicalDeviceTemperature_w[1]) || ($temp > $physicalDeviceTemperature_w[2])) {
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: temperature is ${temp}C, "; }
|
# is in warn range, so also check if in critical error range
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: temperature is ${temp}C, "; }
|
if($physicalDeviceTemperature_c[0] eq "in") {
|
||||||
}
|
if(($temp >= $physicalDeviceTemperature_c[1]) && ($temp <= $physicalDeviceTemperature_c[2])) {
|
||||||
} else {
|
# critical error
|
||||||
if(($temp < $physicalDeviceTemperature_c[1]) || ($temp > $physicalDeviceTemperature_c[2])) {
|
$crit = 1;
|
||||||
# critical error
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
$crit = 1;
|
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive temperature critical, "; }
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: temperature is ${temp}C, "; }
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive temperature critical, "; }
|
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: temperature is ${temp}C, "; }
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: temperature is ${temp}C, "; }
|
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: temperature is ${temp}C, "; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if($crit eq 0) { # only warn if not already given a critical error
|
} else {
|
||||||
$status = getExitState($status, STATE_WARNING);
|
if(($temp < $physicalDeviceTemperature_c[1]) || ($temp > $physicalDeviceTemperature_c[2])) {
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive temperature warning, "; }
|
# critical error
|
||||||
|
$crit = 1;
|
||||||
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
|
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive temperature critical, "; }
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: temperature is ${temp}C, "; }
|
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: temperature is ${temp}C, "; }
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: temperature is ${temp}C, "; }
|
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: temperature is ${temp}C, "; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($crit eq 0) { # only warn if not already given a critical error
|
||||||
|
$status = getExitState($status, STATE_WARNING);
|
||||||
|
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive temperature warning, "; }
|
||||||
|
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: temperature is ${temp}C, "; }
|
||||||
|
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: temperature is ${temp}C, "; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when("Predictive") {
|
}
|
||||||
if($values[4] ne "0") {
|
elsif($values[0] eq "Predictive") {
|
||||||
$status = getExitState($status, STATE_WARNING);
|
if($values[4] ne "0") {
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive Predictive Fail Count not 0, "; }
|
$status = getExitState($status, STATE_WARNING);
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: Predictive Fail Count not 0, "; }
|
if ($VERBOSITY == 0) {$statusMessage .= "Phys. drive Predictive Fail Count not 0, "; }
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: Predictive Fail Count not 0, "; }
|
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: Predictive Fail Count not 0, "; }
|
||||||
}
|
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: Predictive Fail Count not 0, "; }
|
||||||
}
|
}
|
||||||
when("S.M.A.R.T") {
|
}
|
||||||
if($values[6] ne "No") {
|
elsif($values[0] eq "S.M.A.R.T") {
|
||||||
$status = getExitState($status, STATE_WARNING);
|
if($values[6] ne "No") {
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "S.M.A.R.T alert flagged by drive, "; }
|
$status = getExitState($status, STATE_WARNING);
|
||||||
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: S.M.A.R.T alert flagged, "; }
|
if ($VERBOSITY == 0) {$statusMessage .= "S.M.A.R.T alert flagged by drive, "; }
|
||||||
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: S.M.A.R.T alert flagged, "; }
|
if ($VERBOSITY == 1) {$statusMessage .= "Physical drive $output_dev: S.M.A.R.T alert flagged, "; }
|
||||||
}
|
if ($VERBOSITY >= 2) {$statusMessage .= "Physical drive $output_dev in enclosure $output_enc: S.M.A.R.T alert flagged, "; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -652,16 +642,12 @@ sub getBBUStatus {
|
|||||||
$last = $1;
|
$last = $1;
|
||||||
# Check BBU_Info block
|
# Check BBU_Info block
|
||||||
if ($blockid eq 1) {
|
if ($blockid eq 1) {
|
||||||
given($first) {
|
if($first eq "Battery") {
|
||||||
when("Battery") {
|
if($line =~ /\s+([a-zA-Z0-9]*)/) {
|
||||||
if($line =~ /\s+([a-zA-Z0-9]*)/) {
|
if($1 eq "State") {
|
||||||
given($1) {
|
if($last ne "Optimal") {
|
||||||
when("State") {
|
$status = getExitState($status, STATE_WARNING);
|
||||||
if($last ne "Optimal") {
|
$statusMessage .= "BBU state not optimal, ";
|
||||||
$status = getExitState($status, STATE_WARNING);
|
|
||||||
$statusMessage .= "BBU state not optimal, ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -669,81 +655,75 @@ sub getBBUStatus {
|
|||||||
}
|
}
|
||||||
# Check BBU_Firmware_Status
|
# Check BBU_Firmware_Status
|
||||||
if ($blockid eq 2) {
|
if ($blockid eq 2) {
|
||||||
given($first) {
|
if($first eq "Temperature") {
|
||||||
when("Temperature") {
|
if($last ne "OK") {
|
||||||
if($last ne "OK") {
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
if ($VERBOSITY == 0) {$statusMessage .= "BBU temp. critical, "; }
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "BBU temp. critical, "; }
|
if ($VERBOSITY >= 1) {$statusMessage .= "BBU Temperature critical, "; }
|
||||||
if ($VERBOSITY >= 1) {$statusMessage .= "BBU Temperature critical, "; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
when("Battery") {
|
}
|
||||||
if($line =~ /\s+([a-zA-Z0-9]*)/) {
|
elsif($first eq "Battery") {
|
||||||
given($1) {
|
if($line =~ /\s+([a-zA-Z0-9]*)/) {
|
||||||
when("State") {
|
if($1 eq "State") {
|
||||||
if($last ne "Optimal") {
|
if($last ne "Optimal") {
|
||||||
$status = getExitState($status, STATE_WARNING);
|
$status = getExitState($status, STATE_WARNING);
|
||||||
$statusMessage .= "BBU state not optimal, ";
|
$statusMessage .= "BBU state not optimal, ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when("Pack") {
|
elsif($1 eq "Pack") {
|
||||||
if($last ne "No") {
|
if($last ne "No") {
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
$statusMessage .= "BBU pack missing, ";
|
$statusMessage .= "BBU pack missing, ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when("Replacement") {
|
elsif($1 eq "Replacement") {
|
||||||
if($last ne "No") {
|
if($last ne "No") {
|
||||||
$status = getExitState($status, STATE_WARNING);
|
$status = getExitState($status, STATE_WARNING);
|
||||||
$statusMessage .= "BBU replacement required, ";
|
$statusMessage .= "BBU replacement required, ";
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when("Voltage") {
|
}
|
||||||
if($last ne "OK") {
|
elsif($first eq "Voltage") {
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
if($last ne "OK") {
|
||||||
$statusMessage .= "BBU voltage not ok, ";
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
}
|
$statusMessage .= "BBU voltage not ok, ";
|
||||||
}
|
}
|
||||||
when("Learn") {
|
}
|
||||||
if($last ne "OK") {
|
elsif($first eq "Learn") {
|
||||||
$status = getExitState($status, STATE_WARNING);
|
if($last ne "OK") {
|
||||||
$statusMessage .= "BBU learn cycle status not ok, ";
|
$status = getExitState($status, STATE_WARNING);
|
||||||
}
|
$statusMessage .= "BBU learn cycle status not ok, ";
|
||||||
}
|
}
|
||||||
when("I2C") {
|
}
|
||||||
if($last ne "No") {
|
elsif($first eq "I2C") {
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
if($last ne "No") {
|
||||||
$statusMessage .= "BBU I2C errors, ";
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
}
|
$statusMessage .= "BBU I2C errors, ";
|
||||||
}
|
}
|
||||||
when("Remaining") {
|
}
|
||||||
if($last ne "No") {
|
elsif($first eq "Remaining") {
|
||||||
$status = getExitState($status, STATE_WARNING);
|
if($last ne "No") {
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "BBU capacity low, "; }
|
$status = getExitState($status, STATE_WARNING);
|
||||||
if ($VERBOSITY >= 1) {$statusMessage .= "BBU remaining capacity is low, "; }
|
if ($VERBOSITY == 0) {$statusMessage .= "BBU capacity low, "; }
|
||||||
}
|
if ($VERBOSITY >= 1) {$statusMessage .= "BBU remaining capacity is low, "; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Check GasGaugeStatus
|
# Check GasGaugeStatus
|
||||||
if ($blockid eq 3) {
|
if ($blockid eq 3) {
|
||||||
given($first) {
|
if($first eq "Over") {
|
||||||
when("Over") {
|
if($line =~ /\s+([a-zA-Z0-9]*)/) {
|
||||||
if($line =~ /\s+([a-zA-Z0-9]*)/) {
|
if($1 eq "Temperature") {
|
||||||
if($1 eq "Temperature") {
|
if($last ne "No") {
|
||||||
if($last ne "No") {
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
if ($VERBOSITY == 0) {$statusMessage .= "BBU temp. critical, "; }
|
||||||
if ($VERBOSITY == 0) {$statusMessage .= "BBU temp. critical, "; }
|
if ($VERBOSITY >= 1) {$statusMessage .= "BBU Temperature critical, "; }
|
||||||
if ($VERBOSITY >= 1) {$statusMessage .= "BBU Temperature critical, "; }
|
}
|
||||||
}
|
} elsif($1 eq "Charged") {
|
||||||
} elsif($1 eq "Charged") {
|
if($last ne "No") {
|
||||||
if($last ne "No") {
|
$status = getExitState($status, STATE_CRITICAL);
|
||||||
$status = getExitState($status, STATE_CRITICAL);
|
$statusMessage .= "BBU over charged, ";
|
||||||
$statusMessage .= "BBU over charged, ";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -825,7 +805,7 @@ MAIN: {
|
|||||||
my $bbu = 1;
|
my $bbu = 1;
|
||||||
my $platform = $^O;
|
my $platform = $^O;
|
||||||
my $statusMessage = '';
|
my $statusMessage = '';
|
||||||
|
|
||||||
# Check platform
|
# Check platform
|
||||||
if ($platform eq 'linux') {
|
if ($platform eq 'linux') {
|
||||||
chomp($sudo = `which sudo`);
|
chomp($sudo = `which sudo`);
|
||||||
@ -869,7 +849,7 @@ MAIN: {
|
|||||||
'C|controller=i' => \$controller,
|
'C|controller=i' => \$controller,
|
||||||
'EID|enclosure=s' => \@enclosures,
|
'EID|enclosure=s' => \@enclosures,
|
||||||
'LD|logicaldevice=s' => \@logDevices,
|
'LD|logicaldevice=s' => \@logDevices,
|
||||||
'PD|physicaldevice=s' => \@physDevices,
|
'PD|physicaldevice=s' => \@physDevices,
|
||||||
'Tw|temperature-warn=s' => \@temperature_w,
|
'Tw|temperature-warn=s' => \@temperature_w,
|
||||||
'Tc|temperature-critical=s' => \@temperature_c,
|
'Tc|temperature-critical=s' => \@temperature_c,
|
||||||
'PDTw|physicaldevicetemperature-warn=s' => \@physicalDeviceTemperature_w,
|
'PDTw|physicaldevicetemperature-warn=s' => \@physicalDeviceTemperature_w,
|
||||||
@ -954,10 +934,8 @@ MAIN: {
|
|||||||
$newstatusMessage .= $statusMessage;
|
$newstatusMessage .= $statusMessage;
|
||||||
$exitstatus = getExitState($newexitstatus, $exitstatus);
|
$exitstatus = getExitState($newexitstatus, $exitstatus);
|
||||||
}
|
}
|
||||||
given($exitstatus) {
|
if($exitstatus == 0) { print "LSIRAID OK (Ctrl #$controller)\n"; }
|
||||||
when(0) { print "LSIRAID OK (Ctrl #$controller)\n"; }
|
elsif($exitstatus == 1) { chop($newstatusMessage); chop($newstatusMessage); print "LSIRAID WARNING (Ctrl #$controller): [$newstatusMessage]\n"; }
|
||||||
when(1) { chop($newstatusMessage); chop($newstatusMessage); print "LSIRAID WARNING (Ctrl #$controller): [$newstatusMessage]\n"; }
|
elsif($exitstatus == 2) { chop($newstatusMessage); chop($newstatusMessage); print "LSIRAID CRITICAL (Ctrl #$controller): [$newstatusMessage]\n"; }
|
||||||
when(2) { chop($newstatusMessage); chop($newstatusMessage); print "LSIRAID CRITICAL (Ctrl #$controller): [$newstatusMessage]\n"; }
|
|
||||||
}
|
|
||||||
exit($exitstatus);
|
exit($exitstatus);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ It checks the controller, the physical devices and the logical devices seperatel
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Getopt::Long qw(:config no_ignore_case);
|
use Getopt::Long qw(:config no_ignore_case);
|
||||||
use Switch 'Perl6';
|
|
||||||
|
|
||||||
=head1 METHODS
|
=head1 METHODS
|
||||||
|
|
||||||
@ -83,7 +82,8 @@ Returns information about physical devices attached to the LSI raid-controller:
|
|||||||
- Predictive fail count
|
- Predictive fail count
|
||||||
- S.M.A.R.T. status
|
- S.M.A.R.T. status
|
||||||
|
|
||||||
The device temperature can be set to a warning (parameter: B<-PDTw>|B<--physicaldevicetemperature-warn>) and a critical level (parameter: B<-PDTc>|B<--physicaldevicetemperature-critical>). See getThresholds for more information.
|
The device temperature can be set to a warning (parameter: B<-PDTw>|B<--physicaldevicetemperature-warn>)
|
||||||
|
and a critical level (parameter: B<-PDTc>|B<--physicaldevicetemperature-critical>). See getThresholds for more information.
|
||||||
|
|
||||||
=head2 getBBUStatus
|
=head2 getBBUStatus
|
||||||
|
|
||||||
@ -114,9 +114,9 @@ Array content: ("in" or "out", range from, range to).
|
|||||||
|
|
||||||
=head1 LICENSE AND COPYRIGHT
|
=head1 LICENSE AND COPYRIGHT
|
||||||
|
|
||||||
Copyright (c) 2013,
|
Copyright (c) 2013,
|
||||||
Martin Grubhofer C<< <mgrubhofer@thomas-krenn.com> >>, C<< <s1110239013@students.fh-hagenberg.at> >>,
|
Martin Grubhofer C<< <mgrubhofer@thomas-krenn.com> >>, C<< <s1110239013@students.fh-hagenberg.at> >>,
|
||||||
Scheipner Alexander C<< <s1110239032@students.fh-hagenberg.at> >>,
|
Scheipner Alexander C<< <s1110239032@students.fh-hagenberg.at> >>,
|
||||||
Werner Sebastian C<< <s1110239038@students.fh-hagenberg.at> >>.
|
Werner Sebastian C<< <s1110239038@students.fh-hagenberg.at> >>.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
|
|
||||||
.
|
|
Reference in New Issue
Block a user