/[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

Contents of /lib/PXElator/amt.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 203 - (show annotations)
Wed Aug 12 11:35:15 2009 UTC (14 years, 8 months ago) by dpavlin
File size: 883 byte(s)
ping AMT address before trying to get SOAP response
1 package amt;
2
3 use warnings;
4 use strict;
5
6 use lib '/srv/Intel-AMT/lib/';
7 use Intel::AMT::RemoteControl;
8 use Intel::AMT::NetworkAdministration;
9 use Data::Dump qw/dump/;
10 use Regexp::Common qw/net/;
11 use Net::Ping;
12
13 use html;
14
15 sub info {
16 my $amt = shift;
17 my ( $passwd, $ip ) = split(/\s+/, $amt);
18 ( $ip, $passwd ) = ( $passwd, $ip ) if $passwd =~ m/$RE{net}{IPv4}/;
19
20 my $p = Net::Ping->new;
21
22 if ( ! $p->ping( $ip, 0.7 ) ) {
23 return "$ip unreachable";
24 }
25
26 warn "amt $ip ", '*' x length($passwd), "\n";
27
28 $ENV{AMT_HOST} = $ip;
29 $ENV{AMT_PASSWORD} = $passwd;
30
31 my $out;
32
33 $out = qq|power: S| . Intel::AMT::RemoteControl::SystemPowerState
34 . qq|<br>|
35 . qq| <a href="http://$ip:16992/" target="$ip">amt</a>|
36 . qq| <a href="http://$ip:16992/ip.htm" target="$ip">ip</a>|
37 . qq|<br>|
38 . html::pre_dump( Intel::AMT::NetworkAdministration::network_settings )
39 ;
40
41 return $out;
42 }
43
44 1;

  ViewVC Help
Powered by ViewVC 1.1.26