You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
468 B
31 lines
468 B
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
use warnings;
|
|
use JSON;
|
|
use Getopt::Long;
|
|
use File::Which;
|
|
|
|
my $mpath = 1;
|
|
my $pretty = 0;
|
|
my $json = [];
|
|
|
|
GetOptions(
|
|
"mpath" => \$mpath,
|
|
"pretty" => \$pretty
|
|
);
|
|
|
|
my $multipath = which('multipath');
|
|
|
|
if (not defined $multipath){
|
|
print to_json($json, { pretty => $pretty });
|
|
exit 0;
|
|
}
|
|
|
|
foreach (qx($multipath -l -v1)){
|
|
chomp;
|
|
push @{$json}, { '{#MPATH_DEV}' => $_ };
|
|
}
|
|
|
|
print to_json($json, { pretty => $pretty });
|
|
exit 0;
|
|
|