Commit f7e1f38f authored by Erik Sørnes's avatar Erik Sørnes
Browse files

Added mdadm name discovery

parent 7d1120ea
......@@ -36,6 +36,7 @@ use Getopt::Long;
my $file = "/proc/mdstat";
my $device = "all";
my $device_folder = "/dev/md";
# Get command line options.
GetOptions ('file=s' => \$file,
......@@ -45,6 +46,16 @@ GetOptions ('file=s' => \$file,
## Strip leading "/dev/" from --device in case it has been given
$device =~ s/^\/dev\///;
## Strip leading "md/" from --device in case it has been give as part of an mdadm-name
$device =~ s/^md\///;
# construct md-device from symlink, if --device is given as mdadm-name
## if -l $device_folder . "/" . $device {
if (-l $device_folder . "/" . $device) {
$device = readlink $device_folder . "/" . $device;
$device =~ s/\.\.\///;
}
## Return codes for Nagios
my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment