From: Galen Charlton Date: Fri, 6 Feb 2015 15:49:05 +0000 (+0000) Subject: make --diagnostic also report min/max configured drones X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d935b0910a141eb5c4c643d209debae142d00d08;p=working%2FOpenSRF.git make --diagnostic also report min/max configured drones Signed-off-by: Galen Charlton --- diff --git a/bin/opensrf-perl.pl.in b/bin/opensrf-perl.pl.in index 82123af..36d0f13 100755 --- a/bin/opensrf-perl.pl.in +++ b/bin/opensrf-perl.pl.in @@ -228,7 +228,7 @@ sub do_diagnostic { my @conf_services; if ($alive) { - @conf_services = map {$_->{service}} (@perl_services, @nonperl_services); + @conf_services = (@perl_services, @nonperl_services); } my @services; @@ -237,7 +237,7 @@ sub do_diagnostic { } else { @services = get_service_list_from_files(1); if ($alive) { - push(@services, @conf_services); + push(@services, map {$_->{service}} @conf_services); } } @@ -273,12 +273,16 @@ sub do_diagnostic { } else { my @drones = `pgrep -f "Drone \\[$svc\\]"`; $str .= "#drones=".scalar(@drones); + if (my ($service_info) = grep {$_->{service} eq $svc} @conf_services) { + $str .= '/' . $service_info->{min_drones}; + $str .= '/' . $service_info->{max_drones}; + } msg($str); msg("\tERR $svc has no running drones.") unless @drones; } msg("\tERR $svc [$pid] NOT configured for this host.") - unless grep {$_ eq $svc} @conf_services + unless grep {$_->{service} eq $svc} @conf_services or $svc eq 'router'; msg("\tERR $svc [$pid] NOT found in PID file.") @@ -340,12 +344,18 @@ sub do_init { next; } my $lang = $sclient->config_value('apps', $app, 'language') || ''; - my $max_drones = $sclient->config_value('apps', $app, 'unix_config', 'max_children') || 0; my $min_drones = $sclient->config_value('apps', $app, 'unix_config', 'min_children') || 0; + my $max_drones = $sclient->config_value('apps', $app, 'unix_config', 'max_children') || 0; + my $service_info = { + service => $app, + lang => $lang, + min_drones => $min_drones, + max_drones => $max_drones, + }; if ($lang =~ /perl/i) { - push(@perl_services, {service => $app, lang => $lang}); + push(@perl_services, $service_info); } else { - push(@nonperl_services, {service => $app, lang => $lang, max_drones => $max_drones}); + push(@nonperl_services, $service_info); } } }