]>
pere.pagekite.me Git - homepage.git/blob - linux/check_gdth_raid
3 # Author: Petter Reinholdtsen
7 # Nagios module to report the RAID status from the gdth linux kernel
10 # Based on documentation found in
11 # <URL:http://nagiosplug.sourceforge.net/developer-guidelines.html>
23 print "Usage: $0 [-h|--help]\n";
24 print " Reports the gdth status as found in /proc/scsi/gdth/*\n"
27 my $result = GetOptions
("help" => \
$help, "verbose+" => \
$verbose);
34 if ( ! -d
"/proc/scsi/gdth" ) {
35 print "No gdth status file found, /proc/scsi/gdth/ missing";
39 chdir "/proc/scsi/gdth";
43 # Looking for this text block:
45 # Number: 0 Status: ok
46 # Capacity [MB]: 17333 Type: RAID-1
47 # Slave Number: 15 Status: ok
48 # Missing Drv.: 0 Invalid Drv.: 0
50 for my $controller (<*>) {
51 open(INFO
, "< $controller") || die "Unable to read from $controller";
52 # Have to use 'cat', as redirect into egrep didn't work with the
56 last if (/Array Drives:/); # Stop after the Logical Drive block
57 if (m/^\s+Number:\s+(\d+)\s+Status:\s+(\S+)$/) {
58 my ($num, $status) = ($1,$2);
59 if ("ok" ne $status) {
61 $RESULT="$RESULT ID $controller volume $num($status)";
62 # print "Gdth RAID controller $controller volume $num ($status) NOT OK\n"
64 # print "Gdth RAID controller $controller volume $num OK\n"
71 print "gdth RAID OK\n";
73 print "gdth RAID $RESULT NOT OK\n";