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

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

revision 203 by dpavlin, Wed Aug 12 11:35:15 2009 UTC revision 330 by dpavlin, Fri Aug 28 22:29:08 2009 UTC
# Line 8  use Intel::AMT::RemoteControl; Line 8  use Intel::AMT::RemoteControl;
8  use Intel::AMT::NetworkAdministration;  use Intel::AMT::NetworkAdministration;
9  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
10  use Regexp::Common qw/net/;  use Regexp::Common qw/net/;
 use Net::Ping;  
11    
12  use html;  use html;
13    use ping;
14    use CouchDB;
15    
16  sub info {  sub info {
17          my $amt = shift;          my ( $amt, $client_ip ) = @_;
18          my ( $passwd, $ip ) = split(/\s+/, $amt);          my ( $passwd, $ip ) = split(/\s+/, $amt);
19          ( $ip, $passwd ) = ( $passwd, $ip ) if $passwd =~ m/$RE{net}{IPv4}/;          ( $ip, $passwd ) = ( $passwd, $ip ) if $passwd =~ m/$RE{net}{IPv4}/;
20    
21          my $p = Net::Ping->new;          $ip ||= $client_ip;
22    
23          if ( ! $p->ping( $ip, 0.7 ) ) {          if ( ! ping::host( $ip ) ) {
24                  return "$ip unreachable";                  return "$ip unreachable";
25          }          }
26    
# Line 28  sub info { Line 29  sub info {
29          $ENV{AMT_HOST} = $ip;          $ENV{AMT_HOST} = $ip;
30          $ENV{AMT_PASSWORD} = $passwd;          $ENV{AMT_PASSWORD} = $passwd;
31    
32            my $amt = Intel::AMT::NetworkAdministration::network_settings;
33            $amt->{power_state} = Intel::AMT::RemoteControl::SystemPowerState;
34    
35            CouchDB::audit('network', $amt );
36    
37          my $out;          my $out;
38    
39          $out = qq|power: S| . Intel::AMT::RemoteControl::SystemPowerState          $out =
40                  . qq|<br>|                    qq| <a href="http://$ip:16992/" target="$ip">amt</a>|
                 . qq| <a href="http://$ip:16992/" target="$ip">amt</a>|  
41                  . qq| <a href="http://$ip:16992/ip.htm" target="$ip">ip</a>|                  . qq| <a href="http://$ip:16992/ip.htm" target="$ip">ip</a>|
42                  . qq|<br>|                  . qq|<br>|
43                  . html::pre_dump( Intel::AMT::NetworkAdministration::network_settings )                  . html::pre_dump( $amt )
44                  ;                  ;
45    
46          return $out;          return $out;

Legend:
Removed from v.203  
changed lines
  Added in v.330

  ViewVC Help
Powered by ViewVC 1.1.26