summaryrefslogtreecommitdiffstats
path: root/web/attachments/63906-check_linux_raid.patch
blob: 81fa040f6813773a1e80c3300dae49c51e3398c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Index: check_linux_raid.pl
===================================================================
--- check_linux_raid.pl	(revision 145)
+++ check_linux_raid.pl	(working copy)
@@ -26,6 +26,12 @@
 
 my %ERRORS=('DEPENDENT'=>4,'UNKNOWN'=>3,'OK'=>0,'WARNING'=>1,'CRITICAL'=>2);
 
+# die with an error if we're not on Linux
+if ($^O ne 'linux') {
+    print "This plugin only applicable on Linux.\n";
+    exit $ERRORS{'UNKNOWN'};
+}
+
 open (MDSTAT, "</proc/mdstat") or die "Failed to open /proc/mdstat";
 my $found = 0;
 my $status = "";
@@ -41,7 +47,7 @@
             ($finish) = /finish=(.*?min)/;
         }
     } else {
-        if (/$ARGV[0]/) {
+        if (/^$ARGV[0]\s*:/) {
             $found = 1;
             if (/active/) {
                 $active = 1;