/[pxelator]/lib/PXElator/httpd.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 /lib/PXElator/httpd.pm

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

revision 433 by dpavlin, Mon Sep 14 21:11:23 2009 UTC revision 482 by dpavlin, Sat Jan 23 18:31:14 2010 UTC
# Line 63  use nmap; Line 63  use nmap;
63  use ping;  use ping;
64  use wol;  use wol;
65    
66  use CouchDB;  use store;
67    
68    
69  sub menu {  sub menu {
# Line 117  sub static { Line 117  sub static {
117          my $buff;          my $buff;
118          my $pos = 0;          my $pos = 0;
119    
120          CouchDB::audit( 'static', { pid => $$, path => $path, type => $type, size => $size, block => $block, peerhost => $client->peerhost });          store::audit( 'static', { pid => $$, path => $path, type => $type, size => $size, block => $block, peerhost => $client->peerhost });
121    
122          progress_bar::start;          progress_bar::start;
123    
# Line 150  sub get_request { Line 150  sub get_request {
150    
151          server->refresh;          server->refresh;
152    
153          CouchDB::audit( 'request', { path => $path, param => $param, peerhost => $client->peerhost } );          store::audit( 'request', { path => $path, param => $param, peerhost => $client->peerhost } );
154    
155          $title = $path;          $title = $path;
156    
# Line 338  warn "XXX pids = ", dump( $daemons::pids Line 338  warn "XXX pids = ", dump( $daemons::pids
338    
339                  } else {                  } else {
340    
341                            print $client ok qq|<h2>Clients on $server::ip</h2>|;
342    
343                          my @ping;                          my @ping;
344                          if ( my $host = $param->{ping_target} ) {                          if ( my $host = $param->{ping_target} ) {
345                                  @ping = ( $host );                                  @ping = ( $host );
# Line 348  warn "XXX pids = ", dump( $daemons::pids Line 350  warn "XXX pids = ", dump( $daemons::pids
350                          my $ping = ping::fping( @ping ) if @ping;                          my $ping = ping::fping( @ping ) if @ping;
351                          my $arp = client::arp_mac_dev;                          my $arp = client::arp_mac_dev;
352    
353                          print $client ok                          my @clients;
354                                  , qq|<h2>Clients on $server::ip</h2>|  
355                                  , html::table( -5,                          foreach my $ip ( client::all_ips ) {
356                                          'ip', 'mac', 'dev', 'hostname', 'conf',                                  
357                                          map {                                  my $conf = client::all_conf( $ip );
358                                                  my $ip = $_;                                  my $mac = delete $conf->{mac} || '';
359                                                  my $conf = client::all_conf( $ip );                                  my $dev = $arp->{$mac};
360                                                  my $mac = delete $conf->{mac} || '';  
361                                                  my $style;                                  next unless $dev || $param->{all};
362                                                  $style  
363                                                          = 'style="color:'                                  my $style
364                                                          . ( $ping->{$ip} ? 'green' : 'red' )                                          = 'style="color:'
365                                                          . '"'                                          . ( $ping->{$ip} ? 'green' : 'red' )
366                                                          if $ping;                                          . '"'
367                                                  $style ||= '';                                          if $ping;
368                                                  my $ip_text = qq|<tt>$ip</tt>|;  
369                                                  $ip_text = qq|<tt><b>$ip</b></tt>| if ip::in_dhcp_range($ip);                                  $style ||= '';
370                                                  (                                  my $ip_text = qq|<tt>$ip</tt>|;
371                                                          qq|<a $style name=$ip target=client href=/client/$ip>$ip_text</a>|                                  $ip_text = qq|<tt><b>$ip</b></tt>| if ip::in_dhcp_range($ip);
372                                                          , format::mac( $mac => 'html' )  
373                                                          , $arp->{$mac}                                  $dev = qq|<tt>$dev</tt>| if $dev;
374                                                          , delete $conf->{hostname}  
375                                                          , html::conf( $ip, $conf, 'inline' )                                  push @clients
376                                                  )                                          , qq|<a $style name=$ip target=client href=/client/$ip>$ip_text</a>|
377                                          } client::all_ips                                          , format::mac( $mac => 'html' )
378                                  )                                          , $dev
379                                            , delete $conf->{hostname}
380                                            , html::conf( $ip, $conf, 'inline' )
381                                  ;                                  ;
382                            }
383    
384                            my $all = $param->{all} ? 0 : 1;
385    
386                            print $client html::table( -5, 'ip', 'mac', qq|<a href="?all=$all">dev</a>|, 'hostname', 'conf', @clients );
387                          print $client qq|                          print $client qq|
388                                  <form method=get>                                  <form method=get>
389                                  <input type=text   name=ping_target   size=15>                                  <input type=text   name=ping_target   size=15>

Legend:
Removed from v.433  
changed lines
  Added in v.482

  ViewVC Help
Powered by ViewVC 1.1.26