[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 02/02: check_raid: Update to 3.2.1

Jan Wagner waja at moszumanska.debian.org
Tue Oct 7 22:28:10 UTC 2014


This is an automated email from the git hooks/post-receive script.

waja pushed a commit to branch master
in repository pkg-nagios-plugins-contrib.

commit e6dab92a2a7dd1a3d1eff4072acabce84221837a
Author: Jan Wagner <waja at cyconet.org>
Date:   Wed Oct 8 00:17:32 2014 +0200

    check_raid: Update to 3.2.1
---
 check_raid/check_raid | 64 ++++++++++++++++++++++++++++++++++++++-------------
 check_raid/control    |  2 +-
 debian/control        |  4 ++--
 3 files changed, 51 insertions(+), 19 deletions(-)

diff --git a/check_raid/check_raid b/check_raid/check_raid
index 1beaee6..a6faf0a 100644
--- a/check_raid/check_raid
+++ b/check_raid/check_raid
@@ -1023,10 +1023,20 @@ sub parse_ld {
 			$ld{state} = $s;
 			next;
 		}
+
+		if (my($s) = /Default Cache Policy\s*:\s*(.+)/) {
+			$ld{default_cache} = [split /,\s*/, $s];
+			next;
+		}
+
+		if (my($s) = /Current Cache Policy\s*:\s*(.+)/) {
+			$ld{current_cache} = [split /,\s*/, $s];
+			next;
+		}
+
 		if (my($s) = /Exit Code: (\d+x\d+)/) {
 			$rc = hex($s);
-		}
-		else {
+		} else {
 			$rc = 0;
 		}
 	}
@@ -1127,7 +1137,7 @@ sub parse_bbu {
 	return \@bbu;
 }
 
-sub check {
+sub parse {
 	my $this = shift;
 
 	my $pd = $this->parse_pd;
@@ -1138,16 +1148,36 @@ sub check {
 	my @vols = @$ld if $ld;
 	my @bats = @$bbu if $bbu;
 
+	return {
+		logical => $ld,
+		physical => $pd,
+		battery => $bbu,
+	};
+}
+
+sub check {
+	my $this = shift;
+
+	my $c = $this->parse;
+
 	my @vstatus;
-	foreach my $vol (@vols) {
+	foreach my $vol (@{$c->{logical}}) {
 		push(@vstatus, sprintf "%s:%s", $vol->{name}, $vol->{state});
 		if ($vol->{state} ne 'Optimal') {
 			$this->critical;
 		}
+
+		# check cache policy, #65
+		my @wt = grep { /WriteThrough/ } @{$vol->{current_cache}};
+		if (@wt) {
+			my @default = grep { /WriteThrough/ } @{$vol->{default_cache}};
+			# alert if WriteThrough is configured in default
+			$this->cache_fail unless @default;
+		}
 	}
 
 	my %dstatus;
-	foreach my $dev (@devs) {
+	foreach my $dev (@{$c->{physical}}) {
 		if ($dev->{state} eq 'Online' || $dev->{state} eq 'Hotspare' || $dev->{state} eq 'Unconfigured(good)') {
 			push(@{$dstatus{$dev->{state}}}, sprintf "%02d", $dev->{dev});
 
@@ -1159,7 +1189,7 @@ sub check {
 	}
 
 	my (%bstatus, @bpdata, @blongout);
-	foreach my $bat (@bats) {
+	foreach my $bat (@{$c->{battery}}) {
 		if ($bat->{state} !~ /^(Operational|Optimal)$/) {
 			# BBU learn cycle in progress.
 			if ($bat->{charging_status} =~ /^(Charging|Discharging)$/ && $bat->{learn_cycle_active} eq 'Yes') {
@@ -1218,12 +1248,11 @@ sub check {
 		));
 	}
 
-	my @status;
-	push(@status,
-		'Volumes(' . ($#vols + 1) . '): ' . join(',', @vstatus) .
-		'; Devices(' . ($#devs + 1) . '): ' . $this->join_status(\%dstatus) .
-		(@bats ? '; Batteries(' . ($#bats + 1) . '): ' . $this->join_status(\%bstatus) : '')
-	);
+	my @cstatus;
+	push(@cstatus, 'Volumes(' . ($#{$c->{logical}} + 1) . '): ' . join(',', @vstatus));
+	push(@cstatus, 'Devices(' . ($#{$c->{physical}} + 1) . '): ' . $this->join_status(\%dstatus));
+	push(@cstatus, 'Batteries(' . ($#{$c->{battery}} + 1) . '): ' . $this->join_status(\%bstatus)) if @{$c->{battery}};
+	my @status = join('; ', @cstatus);
 
 	my @pdata;
 	push(@pdata,
@@ -3239,11 +3268,12 @@ sub parse {
 
 		# catch enclosures, print_bus_status()
 		# /dev/cciss/c1d0: (Smart Array P800) Enclosure MSA70 (S/N: SGA651004J) on Bus 2, Physical Port 1E status: OK.
+		# /dev/cciss/c0d0: (Smart Array 6i) Enclosure PROLIANT 6L2I (S/N: ) on Bus 0, Physical Port J1 status: OK.
 		if (my($file, $board_name, $name, $sn, $bus, $port1, $port2, $status) = m{
 			^(/dev/[^:]+):\s        # File
 			\(([^)]+)\)\s           # Board Name
-			Enclosure\s(\S+)\s      # Enclosure Name
-			\(S/N:\s(\S+)\)\s        # Enclosure SN
+			Enclosure\s(.+)\s      # Enclosure Name
+			\(S/N:\s(\S*)\)\s       # Enclosure SN
 			on\sBus\s(\d+),\s       # Bus Number
 			Physical\sPort\s(.)     # physical_port1
 			(.)\s                   # physical_port2
@@ -3418,7 +3448,9 @@ sub check {
 			for my $i (sort {$a cmp $b} keys %{$c->{enclosures}}) {
 				my $e = $c->{enclosures}{$i};
 
-				my $s = "$e->{name}($e->{sn}): $e->{status}";
+				my $s = "$e->{name}";
+				$s .= "($e->{sn})" if $e->{sn};
+				$s .= ": $e->{status}";
 				if ($e->{status} !~ '^OK') {
 					$this->critical;
 				}
@@ -4366,7 +4398,7 @@ use Getopt::Long;
 
 my ($opt_V, $opt_d, $opt_h, $opt_W, $opt_S, $opt_p, $opt_l);
 my (%ERRORS) = (OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3);
-my ($VERSION) = "3.2.0";
+my ($VERSION) = "3.2.1";
 my ($message, $status, $perfdata, $longoutput);
 my ($noraid_state) = $ERRORS{UNKNOWN};
 
diff --git a/check_raid/control b/check_raid/control
index 27b3f92..711ff44 100644
--- a/check_raid/control
+++ b/check_raid/control
@@ -1,7 +1,7 @@
 Homepage: https://github.com/glensc/nagios-plugin-check_raid
 Watch: https://github.com/glensc/nagios-plugin-check_raid "/glensc/nagios-plugin-check_raid/tree/([0-9.]+)"
 Suggests: cciss-vol-status (>= 1.10), mpt-status
-Version: 3.2.0
+Version: 3.2.1
 Uploaders: Bernd Zeimetz <bzed at debian.org>
 Description: plugin to check sw/hw RAID status
  The plugin looks for any known types of RAID configurations,
diff --git a/debian/control b/debian/control
index 3536cf5..c93850b 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Vcs-Browser: http://anonscm.debian.org/cgit/pkg-nagios/pkg-nagios-plugins-contri
 Package: nagios-plugins-contrib
 Architecture: any
 Depends: ${misc:Depends}
-Recommends: ${shlibs:Depends}, ${python:Depends}, libsocket-perl, libnagios-plugin-perl, libnet-snmp-perl, whois, nagios-plugins-basic, libnet-dns-perl, libdate-manip-perl, libnagios-plugin-perl (>= 0.31), libnet-cups-perl, libio-socket-ssl-perl, libmail-imapclient-perl, libnet-smtp-tls-perl, libnet-ssleay-perl, python, liblocale-gettext-perl, liblwp-useragent-determined-perl, snmp, freeipmi-tools, libipc-run-perl, ldap-utils, lsof, libyaml-syck-perl, python-pymongo, libdbd-mysql-perl, l [...]
+Recommends: ${shlibs:Depends}, ${python:Depends}, libsocket-perl, libnagios-plugin-perl, libnet-snmp-perl, whois, nagios-plugins-basic, libnet-dns-perl, libdate-manip-perl, libnagios-plugin-perl (>= 0.31), libnet-cups-perl, libio-socket-ssl-perl, libmail-imapclient-perl, libnet-smtp-tls-perl, libnet-ssleay-perl, python, liblocale-gettext-perl, liblwp-useragent-determined-perl, snmp, freeipmi-tools, libipc-run-perl, ldap-utils, lsof, libyaml-syck-perl, python-pymongo, libdbd-mysql-perl, l [...]
 Suggests: backuppc, perl-doc, cciss-vol-status (>= 1.10), mpt-status, smstools (>= 3~), expect, nagios-plugin-check-multi, moreutils, percona-toolkit
 Enhances: nagios-plugins, nagios-plugins-basic, nagios-plugins-standard
 Description: Plugins for nagios compatible monitoring systems
@@ -106,7 +106,7 @@ Description: Plugins for nagios compatible monitoring systems
    * check_printer: plugin to check printer supply levels using SNMP
      It outputs performance data for all supplies
      found, for example toner and drum.
-   * check_raid (3.2.0): plugin to check sw/hw RAID status
+   * check_raid (3.2.1): plugin to check sw/hw RAID status
      The plugin looks for any known types of RAID configurations,
      and checks them all.
      .

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-plugins-contrib.git



More information about the Pkg-nagios-changes mailing list