Fix Zimbra discovery and check scripts

This commit is contained in:
Daniel Berteaud 2022-01-21 12:19:29 +01:00
parent 1950abbc0f
commit 31ccccd2e0
2 changed files with 4 additions and 5 deletions

View File

@ -45,7 +45,7 @@ my $output = {};
if (defined $status){
foreach my $line (qx($zmcontrol status)){
if ($line =~ m/^\s+(\w+)\s+(Running|Stopped)/){
if ($line =~ m/^\s+(\w+)(\swebapp)?\s+(Running|Stopped)/){
$output->{$1} = ($2 eq 'Running') ? 1 : 0;
}
}

View File

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