Permalink
Browse files

付加情報とか

  • Loading branch information...
1 parent e28a4ae commit 5fc073a305a27c5050f5e57bec7a95ce3f21b9db @kazeburo committed Jul 9, 2010
Showing with 14 additions and 2 deletions.
  1. +14 −2 gearman-starter.pl
View
@@ -73,6 +73,7 @@
}
+my $start_time = time();
my $worker = Gearman::Worker->new();
$worker->job_servers(@$servers);
@@ -129,9 +130,14 @@
$SIG{TERM} = sub { exit(0) };
while ( 1 ) {
my $client = $sock->accept();
+ my $system_info = 'gearman_servers: ' . join ",", @$servers;
+ $system_info .= ' prefix: ' . $prefix if $prefix;
+ $system_info .= ' class: ' . join ",", @ARGV;
+ my $uptime = time - $start_time;
+
if ( $scoreboard ) {
- my $raw_stats = '';
my $stats = $scoreboard->read_all();
+ my $raw_stats;
my $busy = 0;
my $idle = 0;
for my $pid ( sort { $a <=> $b } keys %$stats) {
@@ -144,6 +150,8 @@
$raw_stats .= sprintf "%-14d %s\n", $pid, $stats->{$pid}
}
$raw_stats = <<EOF;
+System: $system_info
+Uptime: $uptime
BusyWorkers: $busy
IdleWorkers: $idle
--
@@ -153,7 +161,11 @@
print $client $raw_stats;
}
else {
- print $client "ERROR: scoreboard is disabled\n";
+ print $client <<EOF;
+System: $system_info
+Uptime: $uptime
+ERROR: scoreboard is disabled
+EOF
}
$client->close;
}

0 comments on commit 5fc073a

Please sign in to comment.