Skip to content

Commit

Permalink
Fixed Zimbra Docs status page reporting by asking the docs status
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeXtrasJay authored and umagmrit committed May 19, 2020
1 parent 42ea042 commit 213a44f
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/libexec/zmstatuslog
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#

use strict;
use JSON::PP;
use Data::Dumper;

use lib "/opt/zimbra/common/lib/perl5";
use Zimbra::Util::Common;
Expand Down Expand Up @@ -60,6 +62,10 @@ sub logStatus {
open STATUS, "/opt/zimbra/bin/zmcontrol status |" or die "Can't get status: $!";
@status = <STATUS>;
close STATUS;

my $ismailboxrunning = '';
my $isaloggerserver = '';

foreach my $s (@status) {
if ($s =~ /is not/) {
next;
Expand All @@ -71,9 +77,34 @@ sub logStatus {
}
$s =~ s/ webapp//;
my ($service, $stat) = split ' ', $s, 2;

if (( $service eq 'mailbox' ) && ( $stat eq 'Running' )) {
$ismailboxrunning = 'found';
}

if (( $service eq 'logger' ) && ( $stat eq 'Running' )) {
$isaloggerserver = 'found';
}

Zimbra::Mon::Logger::LogStats( "info", "$dt, STATUS: ${hostname}: $service: $stat" );
}
alarm(0);

if (($ismailboxrunning) && ($isaloggerserver)) {
if ( -e '/opt/zimbra/bin/zxsuite' ) {
my $docs_status = `/opt/zimbra/bin/zxsuite --json docs status`;
my $docs_hash = JSON::PP->new->utf8->decode($docs_status);
my $list_servers = $docs_hash->{'response'};
foreach my $server (@{$list_servers->{servers}}) {
my $status = 'Stopped';
if ( $server->{'status'} eq "online" ) {
$status = 'Running';
}
Zimbra::Mon::Logger::LogStats( "info", "$dt, STATUS: $server->{'name'}: docs: $status" );
}
}
}

alarm(0);
}

sub checkPid {
Expand Down

0 comments on commit 213a44f

Please sign in to comment.