/[Sack]/trunk/lib/Sack/Server.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Sack/Server.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 274 by dpavlin, Wed Apr 28 19:09:54 2010 UTC revision 275 by dpavlin, Wed Apr 28 20:20:35 2010 UTC
# Line 218  while (1) { Line 218  while (1) {
218                                  } elsif ( $method =~ m{^/favicon.ico} ) {                                  } elsif ( $method =~ m{^/favicon.ico} ) {
219                                          print $send "HTTP/1.0 200 OK\r\nContent-Type: image/vnd.microsoft.icon\r\n\r\n", read_file( 'artwork/favicon.ico' );                                          print $send "HTTP/1.0 200 OK\r\nContent-Type: image/vnd.microsoft.icon\r\n\r\n", read_file( 'artwork/favicon.ico' );
220                                          return 1;                                          return 1;
221                                    } elsif ( $method =~ m{/nodes} ) {
222                                            to_all { ping => 1 };
223                                            my @proc = ( 'MemTotal', 'MemFree', 'Buffers', 'Cached', 'VmSize', 'VmPeak' );
224                                            print $send "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n",
225                                                    '<table><tr><th>', join('</th><th>', 'node', 'ip', @proc), '</th></tr>';
226                                            foreach my $node ( sort {
227                                                    $info->{host}->{$a} cmp $info->{host}->{$b} || # ip
228                                                    $a <=> $b # node
229                                            } keys %{$info->{proc}} ) {
230                                                    print $send '<tr><td>', join('</td><td align=right>',
231                                                            $node, $info->{host}->{$node}, map {
232                                                                    my $kb = $info->{proc}->{$node}->{$_};
233                                                                    $kb =~ s/\s+kb//i; $kb;
234                                                            } @proc ), '</td><tr>';
235                                            }
236                                            print $send '</table>';
237                                            return 1;
238                                  }                                  }
239    
240                                  my $refresh = $param->{refresh};                                  my $refresh = $param->{refresh};
# Line 318  while (1) { Line 335  while (1) {
335                                          }                                          }
336                                          print $send qq|<tt$attr>$node</tt>\n|;                                          print $send qq|<tt$attr>$node</tt>\n|;
337                                  }                                  }
338                                    print $send qq|<a href=/nodes/>details</a>|;
339    
340                                  print $send qq|<h1>Shards</h1><ul>|;                                  print $send qq|<h1>Shards</h1><ul>|;
341                                  foreach my $path ( glob '/tmp/sack/*' ) {                                  foreach my $path ( glob '/tmp/sack/*' ) {
# Line 385  while (1) { Line 403  while (1) {
403                                          Storable::store_fd( $response, $sock );                                          Storable::store_fd( $response, $sock );
404                                  } elsif ( $data->{ping} ) {                                  } elsif ( $data->{ping} ) {
405                                          my $port = $data->{port};                                          my $port = $data->{port};
406                                          delete( $info->{pending}->{$port} ) if $info->{pending}->{$port} eq 'forked';                                          delete( $info->{pending}->{$port} ) if defined $info->{pending}->{$port} && $info->{pending}->{$port} eq 'forked';
407                                          $session->{port}->{$port} = $sock;                                          $session->{port}->{$port} = $sock;
408                                          foreach my $name ( keys %{$data->{proc}} ) {                                          foreach my $name ( keys %{$data->{proc}} ) {
409                                                  if ( $name eq 'loadavg' ) {                                                  if ( $name eq 'loadavg' ) {

Legend:
Removed from v.274  
changed lines
  Added in v.275

  ViewVC Help
Powered by ViewVC 1.1.26