diff options
-rw-r--r-- | contrib/check_linux_raid.pl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/check_linux_raid.pl b/contrib/check_linux_raid.pl index 25fdf88..2a58dbe 100644 --- a/contrib/check_linux_raid.pl +++ b/contrib/check_linux_raid.pl | |||
@@ -26,6 +26,12 @@ use strict; | |||
26 | 26 | ||
27 | my %ERRORS=('DEPENDENT'=>4,'UNKNOWN'=>3,'OK'=>0,'WARNING'=>1,'CRITICAL'=>2); | 27 | my %ERRORS=('DEPENDENT'=>4,'UNKNOWN'=>3,'OK'=>0,'WARNING'=>1,'CRITICAL'=>2); |
28 | 28 | ||
29 | # die with an error if we're not on Linux | ||
30 | if ($^O ne 'linux') { | ||
31 | print "This plugin only applicable on Linux.\n"; | ||
32 | exit $ERRORS{'UNKNOWN'}; | ||
33 | } | ||
34 | |||
29 | open (MDSTAT, "</proc/mdstat") or die "Failed to open /proc/mdstat"; | 35 | open (MDSTAT, "</proc/mdstat") or die "Failed to open /proc/mdstat"; |
30 | my $found = 0; | 36 | my $found = 0; |
31 | my $status = ""; | 37 | my $status = ""; |
@@ -43,7 +49,7 @@ while(<MDSTAT>) { | |||
43 | last; | 49 | last; |
44 | } | 50 | } |
45 | } else { | 51 | } else { |
46 | if (/$ARGV[0]/) { | 52 | if (/^$ARGV[0]\s*:/) { |
47 | $found = 1; | 53 | $found = 1; |
48 | if (/active/) { | 54 | if (/active/) { |
49 | $active = 1; | 55 | $active = 1; |