From 40241f2fb828afae5b338bc3dfb26fcd10e148d3 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 19 Apr 2013 18:15:30 +0200 Subject: [PATCH] Return an empty set of ups instead of ZBX_NOTSUPPORTED if no UPS is found or upsc is not installed --- zabbix_scripts/disco_nut_ups | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/zabbix_scripts/disco_nut_ups b/zabbix_scripts/disco_nut_ups index c74a2b8..e5374ea 100644 --- a/zabbix_scripts/disco_nut_ups +++ b/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);