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
This commit is contained in:
Daniel Berteaud 2019-09-19 18:38:39 +02:00
parent dd98d6d2b6
commit 285d61c51c
1 changed files with 3 additions and 3 deletions

View File

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