Merge branch 'master' of git://git.evergreen-ils.org/OpenSRF
authorEquinox <info@esilibrary.com>
Fri, 18 Aug 2017 16:45:02 +0000 (12:45 -0400)
committerEquinox <info@esilibrary.com>
Fri, 18 Aug 2017 16:45:02 +0000 (12:45 -0400)
bin/opensrf-perl.pl.in

index e1c7efc..40015e3 100755 (executable)
@@ -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,14 @@ 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};
+                if (defined($dmax) && $dmax > 0) {
+                    $str .= "#drones=$dcount/$dmax ";
+                    $str .= sprintf('%3d%%', (int(($dcount / $dmax) * 100)));
+                } else {
+                    $str .= "#drones=$dcount";
+                }
                 msg($str);
                 msg("\tERR $svc has no running drones.") unless @drones;
             }
@@ -332,6 +340,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 {