From: Bill Erickson Date: Wed, 16 Aug 2017 18:10:13 +0000 (-0400) Subject: LP#1711194 osrf_config --diagnostic reports max-children X-Git-Tag: osrf_rel_3_0_0-alpha~14 X-Git-Url: http://git.equinoxoli.org/?p=opensrf-equinox.git;a=commitdiff_plain;h=b198681669ed28a510fd0d18d3a89d4dd0837ebe 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 --- 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 {