Set info in the data element for Zimbra discovery

Because when the response is empty, Zabbix will mark the item as unsupported if it can find the data element
tags/zabbix-agent-addons-0.2.80-1
Daniel Berteaud 5 years ago
parent dd98d6d2b6
commit 285d61c51c
  1. 6
      zabbix_scripts/disco_zimbra_sudo

@ -7,7 +7,7 @@ use Net::Domain qw(hostfqdn);
use Data::Dumper; use Data::Dumper;
my $json; my $json;
@{$json} = (); @{$json->{data}} = ();
my $pretty = 0; my $pretty = 0;
my $services = 1; my $services = 1;
@ -47,7 +47,7 @@ if ($services){
}; };
foreach my $service (qx($zmprov getServer $hostname zimbraServiceEnabled)){ foreach my $service (qx($zmprov getServer $hostname zimbraServiceEnabled)){
if ($service =~ m/^zimbraServiceEnabled:\s+(\w+)/){ if ($service =~ m/^zimbraServiceEnabled:\s+(\w+)/){
push @{$json}, { push @{$json->{data}}, {
'{#ZM_SERVICE}' => $1 '{#ZM_SERVICE}' => $1
}; };
} }
@ -55,7 +55,7 @@ if ($services){
} elsif ($servers){ } elsif ($servers){
foreach my $server (qx($zmprov getAllServers)){ foreach my $server (qx($zmprov getAllServers)){
chomp $server; chomp $server;
push @{$json}, { push @{$json->{data}}, {
'{#ZM_SERVER}' => $server '{#ZM_SERVER}' => $server
}; };
} }

Loading…
Cancel
Save