From 31ccccd2e0706900c989484da8d66c0e603f8a99 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 21 Jan 2022 12:19:29 +0100 Subject: [PATCH] Fix Zimbra discovery and check scripts --- zabbix_scripts/check_zimbra_sudo | 2 +- zabbix_scripts/disco_zimbra_sudo | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/zabbix_scripts/check_zimbra_sudo b/zabbix_scripts/check_zimbra_sudo index ae265a5..c782aba 100644 --- a/zabbix_scripts/check_zimbra_sudo +++ b/zabbix_scripts/check_zimbra_sudo @@ -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; } } diff --git a/zabbix_scripts/disco_zimbra_sudo b/zabbix_scripts/disco_zimbra_sudo index 8ed7e07..9568694 100644 --- a/zabbix_scripts/disco_zimbra_sudo +++ b/zabbix_scripts/disco_zimbra_sudo @@ -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 }; }