packages: nagios-plugin-check_raid/check_raid - add linux gdth support
glen
glen at pld-linux.org
Thu Sep 10 09:44:51 CEST 2009
Author: glen Date: Thu Sep 10 07:44:51 2009 GMT
Module: packages Tag: HEAD
---- Log message:
- add linux gdth support
---- Files affected:
packages/nagios-plugin-check_raid:
check_raid (1.24 -> 1.25)
---- Diffs:
================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.24 packages/nagios-plugin-check_raid/check_raid:1.25
--- packages/nagios-plugin-check_raid/check_raid:1.24 Wed Sep 9 19:26:25 2009
+++ packages/nagios-plugin-check_raid/check_raid Thu Sep 10 09:44:45 2009
@@ -14,7 +14,7 @@
#
# Version 1.1 : IPS; Solaris, AIX, Linux software RAID; megaide
# Version 2.0 : Added megaraid, mpt (serveraid), aacli (serveraid)
-# Version 2.1 : Made script more generic and secure
+# Version 2.1 : Made script more generic and secure, Added gdth
use strict;
use Getopt::Long;
@@ -28,10 +28,7 @@
my $cat = find_prog('cat');
# various raids
-my $megaide = 1 if -d '/proc/megaide'; # MegaIDE RAID controller
-my $mdstat = 1 if -f '/proc/mdstat'; # Linux LVM
my $mpt_status = find_prog('mpt-status'); # LSILogic MPT ServeRAID
-my $megaraid = 1 if -d '/proc/megaraid'; # MegaRAID
my $aaccli = find_prog('aaccli'); # Adaptec ServeRAID
my $lsraid = find_prog('lsraid'); # Linux, software RAID
my $metastat = find_prog('metastat'); # Solaris, software RAID
@@ -311,6 +308,35 @@
}
}
+# based on check_gdth by Petter Reinholdtsen
+# http://homepages.uni-paderborn.de/odenbach/projects/check_gdth/
+sub check_gdth {
+# Looking for this text block:
+# Logical Drives:
+# Number: 0 Status: ok
+# Capacity [MB]: 17333 Type: RAID-1
+# Slave Number: 15 Status: ok
+# Missing Drv.: 0 Invalid Drv.: 0
+# To Array Drv.: --
+ for my $file (</proc/scsi/gdth/*>) {
+ open my $fh, '<', $file or return;
+ my ($controller) = $file =~ m{([^/]+$)};
+ while (<$fh>) {
+ chomp;
+ last if (/Array Drives:/); # Stop after the Logical Drive block
+ if (my ($num, $status) = m/^\s+Number:\s+(\d+)\s+Status:\s+(\S+)$/) {
+ if ("ok" ne $status) {
+ $status = $ERRORS{CRITICAL} unless $status;
+ $message .= "gdth:$controller:$num($status) ";
+ } else {
+ $message .= "gdth:$controller:$num($status) ";
+ }
+ }
+ }
+ close($fh);
+ }
+}
+
sub find_prog {
my $prog = shift;
@@ -415,6 +441,7 @@
$status = $ERRORS{OK}; $message = '';
+check_gdth if -d "/proc/scsi/gdth"; # Linux Gdth RAID
check_megaide if -d "/proc/megaide"; # MegaIDE RAID controller
check_mdstat if -f "/proc/mdstat"; # Linux LVM
check_mpt if $mpt_status and -d "/proc/mpt"; # LSILogic MPT ServeRAID
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_raid/check_raid?r1=1.24&r2=1.25&f=u
More information about the pld-cvs-commit
mailing list