--- lib/PXElator/amt.pm 2009/08/09 19:00:52 181
+++ lib/PXElator/amt.pm 2009/08/19 11:02:15 262
@@ -3,17 +3,29 @@
use warnings;
use strict;
-use lib '/home/dpavlin/llin/Intel-AMT/lib/';
+use lib '/srv/Intel-AMT/lib/';
use Intel::AMT::RemoteControl;
use Intel::AMT::NetworkAdministration;
use Data::Dump qw/dump/;
+use Regexp::Common qw/net/;
+use Net::Ping;
use html;
sub info {
- my $amt = shift;
- my ( $passwd, $ip ) = split(/\n/, $amt);
- warn "amt $ip\n";
+ my ( $amt, $client_ip ) = @_;
+ my ( $passwd, $ip ) = split(/\s+/, $amt);
+ ( $ip, $passwd ) = ( $passwd, $ip ) if $passwd =~ m/$RE{net}{IPv4}/;
+
+ $ip ||= $client_ip;
+
+ my $p = Net::Ping->new;
+
+ if ( ! $p->ping( $ip, 0.7 ) ) {
+ return "$ip unreachable";
+ }
+
+ warn "amt $ip ", '*' x length($passwd), "\n";
$ENV{AMT_HOST} = $ip;
$ENV{AMT_PASSWORD} = $passwd;
@@ -22,7 +34,8 @@
$out = qq|power: S| . Intel::AMT::RemoteControl::SystemPowerState
. qq|
|
- . qq|amt|
+ . qq| amt|
+ . qq| ip|
. qq|
|
. html::pre_dump( Intel::AMT::NetworkAdministration::network_settings )
;