[-]
[+]
|
Changed |
nagios-plugins-lsi.changes
|
|
[-]
[+]
|
Changed |
nagios-plugins-lsi.spec
^
|
|
[-]
[+]
|
Added |
check_lsi_raid
^
|
@@ -0,0 +1,1433 @@
+#!/usr/bin/perl -w
+# =============================================================================
+# check_lsi_raid: Nagios/Icinga plugin to check LSI Raid Controller status
+# -----------------------------------------------------------------------------
+# Created as part of a semester project at the University of Applied Sciences
+# Hagenberg (http://www.fh-ooe.at/en/hagenberg-campus/)
+#
+# Copyright (c) 2013-2016:
+# Georg Schoenberger (gschoenberger@thomas-krenn.com)
+# Grubhofer Martin (s1110239013@students.fh-hagenberg.at)
+# Scheipner Alexander (s1110239032@students.fh-hagenberg.at)
+# Werner Sebastian (s1110239038@students.fh-hagenberg.at)
+# Jonas Meurer (jmeurer@inet.de)
+#
+# This program is free software; you can redistribute it and/or modify it under
+# 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
+# version.
+#
+# 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
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, see <http://www.gnu.org/licenses/>.
+# ==============================================================================
+use strict;
+use warnings;
+use Getopt::Long qw(:config no_ignore_case);
+use File::Which;
+
+our $VERBOSITY = 0;
+our $VERSION = "2.5";
+our $NAME = "check_lsi_raid: Nagios/Icinga plugin to check LSI Raid Controller status";
+our $C_TEMP_WARNING = 85;
+our $C_TEMP_CRITICAL = 95;
+our $C_MEM_CORRECTABLE_WARNING = 0;
+our $C_MEM_CORRECTABLE_CRITICAL = 0;
+our $PD_TEMP_WARNING = 40;
+our $PD_TEMP_CRITICAL = 45;
+our $BBU_TEMP_WARNING = 50;
+our $BBU_TEMP_CRITICAL = 60;
+our $CV_TEMP_WARNING = 70;
+our $CV_TEMP_CRITICAL = 85;
+our ($IGNERR_M, $IGNERR_O, $IGNERR_P, $IGNERR_S, $IGNERR_B) = (0, 0, 0, 0, 0);
+our $NOENCLOSURES = 0;
+our $NOWRITEBACKOK = 0;
+our $CONTROLLER = 0;
+
+use constant {
+ STATE_OK => 0,
+ STATE_WARNING => 1,
+ STATE_CRITICAL => 2,
+ STATE_UNKNOWN => 3,
+ };
+
+# Header maps to parse logical and physical devices
+our $LDMAP;
+our @map_a = ('DG/VD','TYPE','State','Access','Consist','Cache','sCC','Size');
+our @map_cc_a = ('DG/VD','TYPE','State','Access','Consist','Cache','Cac','sCC','Size');
+our @pdmap_a = ('EID:Slt','DID','State','DG','Size','Intf','Med','SED','PI','SeSz','Model','Sp');
+
+# Print command line usage to stdout.
+sub displayUsage {
+ print "Usage: \n";
+ print " [ -h | --help ]
+ Display this help page\n";
+ print " [ -v | -vv | -vvv | --verbose ]
+ Sets the verbosity level.
+ No -v is the normal single line output for Nagios/Icinga, -v is a
+ more detailed version but still usable in Nagios. -vv is a
+ multiline output for debugging configuration errors or more
+ detailed information. -vvv is for plugin problem diagnosis.
+ For further information please visit:
+ http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN39\n";
+ print " [ -V --version ]
+ Displays the plugin and, if available, the version of StorCLI.\n";
+ print " [ -C <num> | --controller <num> ]
+ Specifies a controller number, defaults to 0.\n";
+ print " [ -EID <ids> | --enclosure <ids> ]
+ Specifies one or more enclosure numbers, per default all enclosures. Takes either
+ an integer as additional argument or a commaseperated list,
+ e.g. '0,1,2'. With --noenclosures enclosures can be disabled.\n";
+ print " [ -LD <ids> | --logicaldevice <ids>]
+ Specifies one or more logical devices, defaults to all. Takes either an
+ integer as additional argument or a comma seperated list e.g. '0,1,2'.\n";
+ print " [ -PD <ids> | --physicaldevice <ids> ]
+ Specifies one or more physical devices, defaults to all. Takes either an
+ integer as additional argument or a comma seperated list e.g. '0,1,2'.\n";
+ print " [ -Tw <temp> | --temperature-warn <temp> ]
+ Specifies the RAID controller temperature warning threshold, the default
+ threshold is ${C_TEMP_WARNING}C.\n";
+ print " [ -Tc <temp> | --temperature-critical <temp> ]
+ Specifies the RAID controller temperature critical threshold, the default
+ threshold is ${C_TEMP_CRITICAL}C.\n";
+ print " [ -PDTw <temp> | --physicaldevicetemperature-warn <temp> ]
+ Specifies the disk temperature warning threshold, the default threshold
+ is ${PD_TEMP_WARNING}C.\n";
+ print " [ -PDTc <temp> | --physicaldevicetemperature-critical <temp> ]
+ Specifies the disk temperature critical threshold, the default threshold
+ is ${PD_TEMP_CRITICAL}C.\n";
+ print " [ -BBUTw <temp> | --bbutemperature-warning <temp> ]
+ Specifies the BBU temperature warning threshold, default threshold
+ is ${BBU_TEMP_WARNING}C.\n";
+ print " [ -BBUTc <temp> | --bbutemperature-critical <temp> ]
+ Specifies the BBU temperature critical threshold, default threshold
+ is ${BBU_TEMP_CRITICAL}C.\n";
+ print " [ -CVTw <temp> | --cvtemperature-warning <temp> ]
+ Specifies the CV temperature warning threshold, default threshold
+ is ${CV_TEMP_WARNING}C.\n";
+ print " [ -CVTc <temp> | --cvtemperature-critical <temp> ]
+ Specifies the CV temperature critical threshold, default threshold
+ is ${CV_TEMP_CRITICAL}C.\n";
+ print " [ -Im <count> | --ignore-media-errors <count> ]
+ Specifies the warning threshold for media errors per disk, the default
+ threshold is $IGNERR_M.\n";
+ print " [ -Io <count> | --ignore-other-errors <count> ]
+ Specifies the warning threshold for other errors per disk, the default
+ threshold is $IGNERR_O.\n";
+ print " [ -Ip <count> | --ignore-predictive-fail-count <count> ]
+ Specifies the warning threshold for predictive failure analysis errors per disk, the default
+ threshold is $IGNERR_P.\n";
+ print " [ -Is <count> | --ignore-shield-counter <count> ]
+ Specifies the warning threshold for shield counter per disk, the default
+ threshold is $IGNERR_S.\n";
+ print " [ -Ib <count> | --ignore-bbm-counter <count> ]
+ Specifies the warning threshold for bbm errors per disk, the default
+ threshold is $IGNERR_B.\n";
+ print " [ -p <path> | --path <path>]
+ Specifies the path to StorCLI, per default uses the tool 'which' to get
+ the StorCLI path and also checks for binaries in /opt/MegaRAID/storcli.\n";
+ print " [ -b <0/1/2> | --BBU <0/1/2> ]
+ Check if a BBU or a CacheVault module is present. One must be present unless
+ '-b 0' is defined. This ensures that for a given controller a BBU/CV must be
+ present per default. '-b 2' checks if one is present, but does not exit
+ CRITICAL when there is no BBU/CV.\n";
+ print " [ --noenclosures <0/1> ]
+ Specifies if enclosures are present or not. 0 means enclosures are
+ present (default), 1 states no enclosures are used (no 'eall' in
+ storcli commands).\n";
+ print " [ --nowritebackok <0/1> ]
+ Specifies if a WriteThrough Cache configuration is ok or not. 0 means WriteThrough is
+ considered Critical (default), 1 states WriteThrough is ok.\n";
+ print " [ --nosudo ]
+ Turn off using sudo.\n";
+ print " [ --nocleanlogs ]
+ Do not clean storcli logs after running storcli commands.\n";
+}
+
+# Displays a short Help text for the user
+sub displayHelp {
+ print $NAME."\n";
+ print "Pulgin version: " . $VERSION ."\n";
+ print "Copyright (C) 2013-2015 Thomas-Krenn.AG\n";
+ print "Current updates available at
+ https://github.com/thomas-krenn/check_lsi_raid.git\n";
+ print "This Nagios/Icinga Plugin checks LSI RAID controllers for controller,
+physical device, logical device, BBU and CV warnings and errors.\n";
+ print "In order for this plugin to work properly you need to add the nagios
+user to your sudoers file (or create a new one in /etc/sudoers.d/).\n";
+ displayUsage();
+ print "Further information about this plugin can be found at:
+ http://www.thomas-krenn.com/de/wiki/LSI_RAID_Monitoring_Plugin and
+ http://www.thomas-krenn.com/de/wiki/LSI_RAID_Monitoring_Plugin
+Please send an email to the tk-monitoring plugin-user mailing list:
+ tk-monitoring-plugins-user\@lists.thomas-krenn.com
+if you have questions regarding use of this software, to submit patches, or
+suggest improvements.
+Example usage:
+* If StorCli can be found with 'which' or in /opt/MegaRAID/storcli
+ * check_lsi_raid
+* check_lsi_raid -p /opt/MegaRAID/storcli/storcli64
+* check_lsi_raid -p /opt/MegaRAID/storcli/storcli64 -C 1\n";
+ exit(STATE_UNKNOWN);
+}
+
+# Prints the name and the version of check_lsi_raid. If storcli is available,
+# the version of it is printed also.
+# @param storcli The path to storcli command utility
+sub displayVersion {
+ my $storcli = shift;
+ my $writelogs = shift;
+ if(defined($storcli)){
+ my $command = $storcli.' -v';
+ if(!$writelogs) { $command .= ' nolog'; }
+ my @storcliVersion = `$command`;
+ foreach my $line (@storcliVersion){
+ if($line =~ /^\s+StorCli.*/) {
+ $line =~ s/^\s+|\s+$//g;
+ print $line;
+ }
+ }
+ print "\n";
+ }
+ exit(STATE_OK);
+}
+
+# Checks if a storcli call was successfull, i.e. if the line 'Status = Sucess'
|
[-]
[+]
|
Added |
check_percraid_sas
^
|
@@ -0,0 +1,363 @@
+#!/usr/bin/perl -w
+
+# check_megaraid_sas Nagios plugin
+# Copyright (C) 2007 Jonathan Delgado, delgado@molbio.mgh.harvard.edu
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# 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 FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+#
+# Nagios plugin to monitor the status of volumes attached to a LSI Megaraid SAS
+# controller, such as the Dell PERC5/i and PERC5/e. If you have any hotspares
+# attached to the controller, you can specify the number you should expect to
+# find with the '-s' flag.
+#
+# The paths for the Nagios plugins lib and MegaCli may need to me changed.
+#
+# Code for correct RAID level reporting contributed by Frode Nordahl, 2009/01/12.
+# Some other code contributed by Morty Abzug, 2015-05-20
+#
+# $Author: delgado $
+# $Revision: #12 $ $Date: 2010/10/18 $
+
+use strict;
+use Getopt::Long;
+use lib qw(/usr/lib/nagios/plugins /usr/lib64/nagios/plugins); # possible pathes to your Nagios plugins and utils.pm
+use utils qw(%ERRORS);
+
+my $megaclibin = '/usr/sbin/perccli'; # the full path to your MegaCli binary
+my $megacli = "$megaclibin"; # how we actually call MegaCli
+my $megapostopt = '-NoLog'; # additional options to call at the end of MegaCli arguments
+
+my ($adapters);
+my $hotspares = 0;
+my $hotsparecount = 0;
+my $pdbad = 0;
+my $pdcount = 0;
+my $mediaerrors = 0;
+my $mediaallow = 0;
+my $consistency_check_is_ok = 0;
+my $missing_is_ok = 0;
+my $no_battery_is_ok = 0;
+my $prederrors = 0;
+my $predallow = 0;
+my $othererrors = 0;
+my $otherallow = 0;
+my $result = '';
+my $status = 'OK';
+my $sudo;
+my $checkbbu = 0;
+my $bbu_charge_no_warning = 0;
+my $check_cache;
+my $do_help;
+
+# handle options
+Getopt::Long::Configure("bundling");
+GetOptions(
+ "b|bbu_check" => \$checkbbu,
+ "B|bbu_charge_no_warning" => \$bbu_charge_no_warning,
+ "c|cache_check" => \$check_cache,
+ "h|help" => \$do_help,
+ "m|media_allow=i" => \$mediaallow,
+ "consistency_check_is_ok" => \$consistency_check_is_ok,
+ "missing_is_ok" => \$missing_is_ok,
+ "no_battery_is_ok" => \$no_battery_is_ok,
+ "o|other_allow=i" => \$otherallow,
+ "p|pred_allow=i" => \$predallow,
+ "s|hotspares=i" => \$hotspares,
+ "sudo" => \$sudo,
+ );
+
+if ( $do_help ) {
+ print "Usage: $0 [-s number] [-m number] [-o number]\n";
+ print " -b check Battery Back Up status\n";
+ print " -B battery back up charging state is not a warning\n";
+ print " -c check that current cache policy matches default policy\n";
+ print " -m is the number of media errors to ignore\n";
+ print " --consistency_check_is_ok consistency checks are OK\n";
+ print " --missing_is_ok test returns OK if MegaCli is not present\n";
+ print " --no_battery_is_ok lack of a battery is not a problem\n";
+ print " -p is the predictive error count to ignore\n";
+ print " -o is the number of other disk errors to ignore\n";
+ print " -s is how many hotspares are attached to the controller\n";
+ print " --sudo should sudo be enabled\n";
+ exit;
+}
+
+sub max_state ($$) {
+ my ($current, $compare) = @_;
+
+ if (($compare eq 'CRITICAL') || ($current eq 'CRITICAL')) {
+ return 'CRITICAL';
+ } elsif ($compare eq 'OK') {
+ return $current;
+ } elsif ($compare eq 'WARNING') {
+ return 'WARNING';
+ } elsif (($compare eq 'UNKNOWN') && ($current eq 'OK')) {
+ return 'UNKNOWN';
+ } else {
+ return $current;
+ }
+}
+
+sub exitreport ($$) {
+ my ($status, $message) = @_;
+
+ print STDOUT "$status: $message\n";
+ exit $ERRORS{$status};
+}
+
+
+# Some sanity checks that you actually have something where you think MegaCli is
+if (! -e $megaclibin) {
+ if ($missing_is_ok) {
+ exitreport($status, "$megaclibin is not present, missing_is_ok set")
+ } else {
+ exitreport('UNKNOWN',"error: $megaclibin does not exist");
+ }
+}
+
+$megacli="sudo $megacli" if $sudo;
+
+# Get the number of RAID controllers we have
+open (ADPCOUNT, "$megacli -adpCount $megapostopt |")
+ || exitreport('UNKNOWN',"error: Could not execute $megacli -adpCount $megapostopt");
+
+while (<ADPCOUNT>) {
+ if ( m/Controller Count:\s*(\d+)/ ) {
+ $adapters = $1;
+ last;
+ }
+}
+close ADPCOUNT;
+
+exitreport('UNKNOWN',"error: unable to get controller count")
+ if !defined $adapters;
+
+ADAPTER: for ( my $adp = 0; $adp < $adapters; $adp++ ) {
+ $result .= "$adp:";
+ # Get the Battery Back Up state for this adapter
+ my ($bbustate);
+ if ($checkbbu) {
+ open (BBUGETSTATUS, "$megacli -AdpBbuCmd -GetBbuStatus -a$adp $megapostopt |")
+ || exitreport('UNKNOWN', "error: Could not execute $megacli -AdpBbuCmd -GetBbuStatus -a$adp $megapostopt");
+
+ my ($bbucharging, $bbufullycharged, $bburelativecharge, $bbuexitcode);
+ my ($batterystate, $batteryreplacement, $issohgood);
+ while (<BBUGETSTATUS>) {
+ # Charging Status
+ if ( m/Charging Status\s*:\s*(\w+)/i ) {
+ $bbucharging = $1;
+ } elsif ( m/Battery State\s*:\s*(\w+.*)/i) { # sometimes contains a space
+ $batterystate = $1;
+ } elsif ( m/Fully Charged\s*:\s*(\w+)/i ) {
+ $bbufullycharged = $1;
+ } elsif ( m/Relative State of Charge\s*:\s*(\w+)/i ) {
+ $bburelativecharge = $1;
+ } elsif ( m/Exit Code\s*:\s*(\w+)/i ) {
+ $bbuexitcode = $1;
+ } elsif ( m/^\s*Battery Replacement required\s*:\s(\w+)\s*$/i) {
+ $batteryreplacement = $1;
+ } elsif ( m/^\s*isSOHGood\s*:\s*(\w+)\s*$/i) {
+ $issohgood = $1;
+ }
+ }
+ close BBUGETSTATUS;
+
+ # Determine the BBU state
+ if ( !defined $bbuexitcode || $bbuexitcode ne '0x00' ) {
+ if (!$no_battery_is_ok) {
+ $bbustate = 'NOT FOUND';
+ $status = max_state($status, 'CRITICAL');
+ } else {
+ $bbustate = 'not found which could be ok';
+ }
+ } elsif ( lc $batteryreplacement ne 'no' ) {
+ $bbustate = 'battery needs replacing';
+ $status = max_state($status, 'CRITICAL');
+ } elsif ( defined $issohgood && lc $issohgood ne 'yes' ) {
+ $bbustate = 'battery SOH is not good';
+ $status = max_state($status, 'CRITICAL');
+ } elsif ( $bbucharging ne 'None' && !$bbu_charge_no_warning) {
+ $bbustate = 'Charging (' . $bburelativecharge . '%)';
+ $status = max_state($status, 'WARNING');
+ } elsif ( defined $bbufullycharged && $bbufullycharged ne 'Yes' && !$bbu_charge_no_warning) {
+ # some adapters don't report on "Fully Charged", so
+ # it's OK if it's not defined.
+ $bbustate = 'Not Charging (' . $bburelativecharge . '%)';
+ $status = max_state($status, 'WARNING');
|