Don't return garbage in mpath discovery if command failed

tags/zabbix-agent-addons-0.2.131-1
Daniel Berteaud 4 years ago
parent 975e8f1ccc
commit cd790587e6
  1. 8
      zabbix_scripts/disco_mpath_sudo

@ -22,7 +22,13 @@ if (not defined $multipath){
exit 0;
}
foreach (qx($multipath -l -v1)){
my @dev = qx($multipath -l -v1);
# If command failed (eg no /etc/multipath.conf), then return an empty result
if ($? ne 0){
print to_json($json, { pretty => $pretty });
exit 1;
}
foreach (@dev){
chomp;
push @{$json}, { '{#MPATH_DEV}' => $_ };
}

Loading…
Cancel
Save