diff -ruN nagiosplug-save/contrib/check_linux_raid.pl nagiosplug/contrib/check_linux_raid.pl
--- nagiosplug-save/contrib/check_linux_raid.pl	2002-08-14 20:01:58.000000000 +0100
+++ nagiosplug/contrib/check_linux_raid.pl	2004-03-27 22:17:23.000000000 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl -wT
 
 # Copyright (c) 2002 ISOMEDIA, Inc.
 # Written by Steve Milton
@@ -22,9 +22,28 @@
 # Example: check_raid md0
 #          WARNING md0 status=[UUU_U], recovery=46.4%, finish=123.0min
 
+require 5.004;
 use strict;
+use lib utils.pm ;
+use Plugin;
+use Plugin::Parameter qw(:DEFAULT);
 
-my %ERRORS=('DEPENDENT'=>4,'UNKNOWN'=>3,'OK'=>0,'WARNING'=>1,'CRITICAL'=>2);
+use vars qw($PROGNAME $opt_t $opt_raiddevice);
+
+use utils qw(%ERRORS);
+
+my $d_opt = new Plugin::Parameter(-name => "raiddevice",
+				  -optional => "no", -valueoptional => "no", -type => "RAIDDEVICENAME",
+				  -description => "Raid device to be checked for status");
+my $plugin = new Plugin(-revision => '$Revision: 1.1 $',
+			-copyright => "2002 ISOMEDIA, Inc, 2004 Howard Wilkinson <howard\@cohtech.com>",
+			-shortcomment => "Plugin to check raid device status",
+			-parameterlists => [ [ $d_opt, $t_opt ], $h_opts, $V_opts ]);
+
+
+$plugin->init();
+
+$plugin->start_timeout($opt_t, "Failed to read data from MDSTAT");
 
 open (MDSTAT, "</proc/mdstat") or die "Failed to open /proc/mdstat";
 my $found = 0;
@@ -32,49 +51,54 @@
 my $recovery = "";
 my $finish = "";
 my $active = "";
-while(<MDSTAT>) {
+foreach my $line (<MDSTAT>) {
     if ($found) {
-        if (/(\[[_U]+\])/) {
+        if ($line =~ m/(\[[_U]+\])/) {
             $status = $1;
-        } elsif (/recovery = (.*?)\s/) {  
+        } elsif ($line =~ m/recovery = (.*?)\s/) {  
             $recovery = $1;
-            ($finish) = /finish=(.*?min)/;
+            ($finish) = $line =~ /finish=(.*?min)/;
         }
+	last;
     } else {
-        if (/$ARGV[0]/) {
+        if ($line =~ m/$opt_raiddevice/) {
             $found = 1;
-            if (/active/) {
+            if ($line =~ /active/) {
                 $active = 1;
             }
         }
     }
 }
 
+close (MDSTAT);
+
+$plugin->stop_timeout();
+
 my $msg = "FAILURE";
 my $code = "UNKNOWN";
 if ($status =~ /_/) {
     if ($recovery) {
-        $msg = sprintf "%s status=%s, recovery=%s, finish=%s\n",
-        $ARGV[0], $status, $recovery, $finish;
+        $msg = sprintf "%s status=%s, recovery=%s, finish=%s",
+        $opt_raiddevice, $status, $recovery, $finish;
         $code = "WARNING";
     } else {
-        $msg = sprintf "%s status=%s\n", $ARGV[0], $status;
+        $msg = sprintf "%s status=%s", $opt_raiddevice, $status;
         $code = "CRITICAL";
     }
 } elsif ($status =~ /U+/) {
-    $msg = sprintf "%s status=%s\n", $ARGV[0], $status;
+    $msg = sprintf "%s status=%s", $opt_raiddevice, $status;
     $code = "OK";
 } else {
     if ($active) {
-        $msg = sprintf "%s active with no status information.\n",
-        $ARGV[0];
+        $msg = sprintf "%s active with no status information",
+        $opt_raiddevice;
         $code = "OK";
     } else {
-        $msg = sprintf "%s does not exist.\n", $ARGV[0];
+        $msg = sprintf "%s does not exist", $opt_raiddevice;
         $code = "CRITICAL";
     }
 }
 
-print $code, " ", $msg;
+print "$PROGNAME $code: $msg\n";
 exit ($ERRORS{$code});
 
