From b198681669ed28a510fd0d18d3a89d4dd0837ebe Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 16 Aug 2017 14:10:13 -0400 Subject: [PATCH] LP#1711194 osrf_config --diagnostic reports max-children --diagnostic output shows the maximum number of allowed drones per service along with the active drone count. Additionally, a usage percentage value is displayed. E.g. $ /openils/bin/osrf_control -l --diagnostic * open-ils.acq [1581] uptime=00:35 cputime=00:00:00 #drones=1/15 6% * open-ils.actor [1629] uptime=00:35 cputime=00:00:00 #drones=2/15 13% Signed-off-by: Bill Erickson Signed-off-by: Chris Sharp Signed-off-by: Galen Charlton --- bin/opensrf-perl.pl.in | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/opensrf-perl.pl.in b/bin/opensrf-perl.pl.in index e1c7efc..021f00e 100755 --- a/bin/opensrf-perl.pl.in +++ b/bin/opensrf-perl.pl.in @@ -65,6 +65,7 @@ my $opt_ignore_orphans = 0; my $sclient; my @perl_services; my @nonperl_services; +my %max_children_map; my $hostname = $ENV{OSRF_HOSTNAME} || hostfqdn(); GetOptions( @@ -264,7 +265,10 @@ sub do_diagnostic { msg($str); } else { my @drones = `pgrep -f "Drone \\[$svc\\]"`; - $str .= "#drones=".scalar(@drones); + my $dcount = scalar(@drones); + my $dmax = $max_children_map{$svc}; + $str .= "#drones=$dcount/$dmax "; + $str .= sprintf('%3d%%', (int(($dcount / $dmax) * 100))); msg($str); msg("\tERR $svc has no running drones.") unless @drones; } @@ -332,6 +336,10 @@ sub do_init { next; } my $lang = $sclient->config_value('apps', $app, 'language') || ''; + + $max_children_map{$app} = $sclient->config_value( + 'apps', $app, 'unix_config', 'max_children'); + if ($lang =~ /perl/i) { push(@perl_services, $app); } else { -- 2.43.2