Author: glen                         Date: Tue Oct  6 13:15:05 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- Added HP/Compaq Smarty Array via cciss_vol_status

---- Files affected:
packages/nagios-plugin-check_raid:
   check_raid (1.49 -> 1.50) , nagios-plugin-check_raid.spec (1.8 -> 1.9) 

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.49 
packages/nagios-plugin-check_raid/check_raid:1.50
--- packages/nagios-plugin-check_raid/check_raid:1.49   Mon Oct  5 15:06:45 2009
+++ packages/nagios-plugin-check_raid/check_raid        Tue Oct  6 15:14:59 2009
@@ -20,6 +20,7 @@
 # - Added Adaptec AAC-RAID via arcconf
 # - Added LSI MegaRaid via megarc
 # - Added LSI MegaRaid via CmdTool2
+# - Added HP/Compaq Smarty Array via cciss_vol_status
 
 use strict;
 use Getopt::Long;
@@ -44,6 +45,7 @@
 my $arcconf = which('arcconf');
 my $megarc = which('megarc');
 my $cmdtool2 = which('CmdTool2');
+my $cciss_vol_status = which('cciss_vol_status');
 
 #####################################################################
 sub print_usage () {
@@ -707,6 +709,68 @@
        $message .= "CmdTool2: ".join(', ', @status) if @status;
 }
 
+sub check_cciss {
+       unless ($cciss_vol_status) {
+               $message .= "cciss:cciss_vol_status program not found";
+               $status = $ERRORS{CRITICAL};
+               return;
+       }
+
+       my @CMD = $cciss_vol_status;
+       unshift(@CMD, $sudo) if $> and $sudo;
+
+       # status messages pushed here
+       my @status;
+
+       # find controllers
+#      cciss0: HP Smart Array P400i Controller
+#      Board ID: 0x3235103c
+#      Firmware Version: 4.06
+#      IRQ: 98
+#      Logical drives: 1
+#      Current Q depth: 0
+#      Current # commands on controller: 0
+#      Max Q depth since init: 249
+#      Max # commands on controller since init: 275
+#      Max SG entries since init: 31
+#      Sequential access devices: 0
+#
+#      cciss/c0d0:      220.12GB       RAID 1(1+0)
+
+       my @c;
+       foreach my $f (</proc/driver/cciss/*>) {
+               open my $fh, '<', $f or next;
+               while (<$fh>) {
+                       next unless (my($s) = m{^(cciss/[^:]+):});
+                       push(@c, "/dev/$s");
+               }
+               close $fh;
+       }
+
+       unless (@c) {
+               $status = $ERRORS{WARNING} unless $status;
+               $message .= "cciss: No Smart Array Adapters were found on this 
machine";
+               return;
+       }
+
+       foreach my $c (@c) {
+               open(my $fh , '-|', @CMD, $c) or return;
+               while (<$fh>) {
+                       chomp;
+                       # /dev/cciss/c0d0: (Smart Array P400i) RAID 1 Volume 0 
status: OK.
+                       if (my($s) = /status: (\S+)\./) {
+                               if ($s ne 'OK') {
+                                       $status = $ERRORS{CRITICAL};
+                               }
+                               push(@status, $_);
+                       }
+               }
+               close($fh);
+       }
+
+       $message .= "cciss: ".join(', ', @status) if @status;
+}
+
 sub which {
        my $prog = shift;
 
@@ -745,6 +809,21 @@
                push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $cat $mr\n") if -d 
$mr;
        }
 
+       if ($cciss_vol_status) {
+               my @c;
+               foreach my $f (</proc/driver/cciss/*>) {
+                       open my $fh, '<', $f or next;
+                       while (<$fh>) {
+                               next unless (my($s) = m{^(cciss/[^:]+):});
+                               push(@c, "/dev/$s");
+                       }
+                       close $fh;
+               }
+               foreach my $c (@c) {
+                       push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: 
$cciss_vol_status $c\n");
+               }
+       }
+
        unless (@sudo) {
                print "Your configuration does not need to use sudo, sudoers 
not updated\n";
                return;
@@ -842,6 +921,7 @@
 check_arcconf if $arcconf;
 check_megarc if $megarc;
 check_cmdtool2 if $cmdtool2;
+check_cciss if -d "/proc/driver/cciss";
 
 if ($message) {
        if ($status == $ERRORS{OK}) {

================================================================
Index: packages/nagios-plugin-check_raid/nagios-plugin-check_raid.spec
diff -u packages/nagios-plugin-check_raid/nagios-plugin-check_raid.spec:1.8 
packages/nagios-plugin-check_raid/nagios-plugin-check_raid.spec:1.9
--- packages/nagios-plugin-check_raid/nagios-plugin-check_raid.spec:1.8 Mon Oct 
 5 14:17:45 2009
+++ packages/nagios-plugin-check_raid/nagios-plugin-check_raid.spec     Tue Oct 
 6 15:14:59 2009
@@ -3,7 +3,7 @@
 Summary:       Nagios plugin to check current server's RAID status
 Name:          nagios-plugin-%{plugin}
 Version:       2.1
-Release:       1
+Release:       2
 License:       GPL v2
 Group:         Networking
 Source0:       %{plugin}
@@ -13,6 +13,7 @@
 Requires:      sudo
 Suggests:      CmdTool2
 Suggests:      arcconf
+Suggests:      cciss_vol_status
 Suggests:      megarc-scsi
 Suggests:      mpt-status
 Suggests:      tw_cli-9xxx
@@ -32,6 +33,7 @@
 - 3ware SATA RAID
 - Adaptec AAC RAID
 - LSI MegaRaid
+- HP/Compaq Smarty Array
 
 %prep
 %setup -qcT
@@ -69,6 +71,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.9  2009/10/06 13:14:59  glen
+- Added HP/Compaq Smarty Array via cciss_vol_status
+
 Revision 1.8  2009/10/05 12:17:45  glen
 - add MegaRAID SAS via CmdTool2
 
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_raid/check_raid?r1=1.49&r2=1.50&f=u
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_raid/nagios-plugin-check_raid.spec?r1=1.8&r2=1.9&f=u

_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to