Author: glen                         Date: Mon Oct  5 12:17:50 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add MegaRAID SAS via CmdTool2

---- Files affected:
packages/nagios-plugin-check_raid:
   check_raid (1.47 -> 1.48) , nagios-plugin-check_raid.spec (1.7 -> 1.8) 

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.47 
packages/nagios-plugin-check_raid/check_raid:1.48
--- packages/nagios-plugin-check_raid/check_raid:1.47   Mon Sep 14 16:22:54 2009
+++ packages/nagios-plugin-check_raid/check_raid        Mon Oct  5 14:17:45 2009
@@ -19,6 +19,7 @@
 # - Added 3ware SATA RAID
 # - Added Adaptec AAC-RAID via arcconf
 # - Added LSI MegaRaid via megarc
+# - Added LSI MegaRaid via CmdTool2
 
 use strict;
 use Getopt::Long;
@@ -42,6 +43,7 @@
 my $tw_cli = which('tw_cli-9xxx') || which('tw_cli');
 my $arcconf = which('arcconf');
 my $megarc = which('megarc');
+my $cmdtool2 = which('CmdTool2');
 
 #####################################################################
 sub print_usage () {
@@ -659,6 +661,52 @@
        $message = "megarc: ".join(', ', @status) if @status;
 }
 
+sub check_cmdtool2 {
+       my @CMD = $cmdtool2;
+       unshift(@CMD, $sudo) if $> and $sudo;
+
+       # status messages pushed here
+       my @status;
+
+       # get adapters
+       open(my $fh , '-|', @CMD, '-AdpAllInfo', '-aALL', '-nolog') or return;
+       my @c;
+       while (<$fh>) {
+               if (my($c) = /^Adapter #(\d+)/) {
+                       push(@c, $c);
+               }
+       }
+       close $fh;
+
+       unless (@c) {
+               $status = $ERRORS{WARNING} unless $status;
+               $message = "CmdTool2: No LSI adapters were found on this 
machine";
+               return;
+       }
+
+       foreach my $c (@c) {
+               open($fh , '-|', @CMD, '-CfgDsply', "-a$c", '-nolog') or return;
+               my ($d);
+               while (<$fh>) {
+                       # DISK GROUPS: 0
+                       if (my($s) = /^DISK GROUPS: (\d+)/) {
+                               $d = int($s);
+                               next;
+                       }
+
+                       # State: Optimal
+                       if (my($s) = /^State: (\S+)$/) {
+                               if ($s ne 'Optimal') {
+                                       $status = $ERRORS{CRITICAL};
+                               }
+                               push(@status, "Logical Drive $c,$d: $s");
+                       }
+               }
+       }
+
+       $message = "CmdTool2: ".join(', ', @status) if @status;
+}
+
 sub which {
        my $prog = shift;
 
@@ -691,6 +739,8 @@
        push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $arcconf GETCONFIG 1 *\n") 
if $arcconf;
        push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $megarc -AllAdpInfo 
-nolog\n") if $megarc;
        push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $megarc -dispCfg -a* 
-nolog\n") if $megarc;
+       push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $cmdtool2 -AdpAllInfo 
-nolog\n") if $cmdtool2;
+       push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $cmdtool2 -CfgDsply -a* 
-nolog\n") if $cmdtool2;
        foreach my $mr (glob('/proc/mega*/*/raiddrives*')) {
                push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $cat $mr\n") if -d 
$mr;
        }
@@ -790,6 +840,7 @@
 check_tw_cli if $tw_cli;
 check_arcconf if $arcconf;
 check_megarc if $megarc;
+check_cmdtool2 if $cmdtool2;
 
 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.7 
packages/nagios-plugin-check_raid/nagios-plugin-check_raid.spec:1.8
--- packages/nagios-plugin-check_raid/nagios-plugin-check_raid.spec:1.7 Mon Sep 
28 19:46:57 2009
+++ packages/nagios-plugin-check_raid/nagios-plugin-check_raid.spec     Mon Oct 
 5 14:17:45 2009
@@ -11,10 +11,11 @@
 Source1:       %{plugin}.cfg
 Requires:      nagios-core
 Requires:      sudo
+Suggests:      CmdTool2
 Suggests:      arcconf
+Suggests:      megarc-scsi
 Suggests:      mpt-status
 Suggests:      tw_cli-9xxx
-Suggests:      megarc-scsi
 BuildArch:     noarch
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -68,6 +69,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.8  2009/10/05 12:17:45  glen
+- add MegaRAID SAS via CmdTool2
+
 Revision 1.7  2009/09/28 17:46:57  glen
 - release 1
 
================================================================

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

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to