Return an empty set of ups instead of ZBX_NOTSUPPORTED if no UPS is found or upsc is not installed

tags/zabbix-agent-addons-0.2.20-1
Daniel Berteaud 12 years ago
parent 7d7f7e27de
commit 40241f2fb8
  1. 6
      zabbix_scripts/disco_nut_ups

@ -3,15 +3,13 @@
use JSON;
my $json;
@{$json->{data}} = ();
if (system("upsc -l >/dev/null 2>&1") == 0){
foreach my $ups (`upsc -l`){
chomp($ups);
push @{$json->{data}}, {"{#UPSNAME}" => $ups};
}
print to_json($json) if (defined $json->{data});
}
else{
print 'ZBX_NOTSUPPORTED';
}
print to_json($json);
exit(0);

Loading…
Cancel
Save