mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-04-24 15:53:05 -04:00
Better error checking (820806)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@948 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
parent
d2e51944f4
commit
b51ab9df98
1 changed files with 7 additions and 1 deletions
|
|
@ -26,6 +26,12 @@ use strict;
|
|||
|
||||
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 = "";
|
||||
|
|
@ -43,7 +49,7 @@ while(<MDSTAT>) {
|
|||
last;
|
||||
}
|
||||
} else {
|
||||
if (/$ARGV[0]/) {
|
||||
if (/^$ARGV[0]\s*:/) {
|
||||
$found = 1;
|
||||
if (/active/) {
|
||||
$active = 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue