12 |
|
|
13 |
use html; |
use html; |
14 |
use ping; |
use ping; |
15 |
use CouchDB; |
use store; |
16 |
use Carp qw/confess/; |
use Carp qw/confess/; |
17 |
|
|
18 |
sub ip { |
sub ip { |
36 |
|
|
37 |
sub power_state { |
sub power_state { |
38 |
my $state = eval { Intel::AMT::RemoteControl::SystemPowerState }; |
my $state = eval { Intel::AMT::RemoteControl::SystemPowerState }; |
39 |
CouchDB::audit('SystemPowerState', { ip => $ENV{AMT_HOST}, SystemPowerState => $state }); |
store::audit('SystemPowerState', { ip => $ENV{AMT_HOST}, SystemPowerState => $state }); |
40 |
return $state; |
return $state; |
41 |
} |
} |
42 |
|
|
54 |
warn "ERROR $@"; |
warn "ERROR $@"; |
55 |
} else { |
} else { |
56 |
$amt->{ip} = $ENV{AMT_HOST}; |
$amt->{ip} = $ENV{AMT_HOST}; |
57 |
CouchDB::audit('log', $amt ); |
store::audit('log', $amt ); |
58 |
} |
} |
59 |
$amt; |
$amt; |
60 |
} |
} |
67 |
warn "ERROR $@"; |
warn "ERROR $@"; |
68 |
} else { |
} else { |
69 |
$amt->{ip} = $ENV{AMT_HOST}; |
$amt->{ip} = $ENV{AMT_HOST}; |
70 |
CouchDB::audit('log', $amt ); |
store::audit('log', $amt ); |
71 |
} |
} |
72 |
$amt; |
$amt; |
73 |
} |
} |
76 |
ip shift; |
ip shift; |
77 |
my $command = shift; |
my $command = shift; |
78 |
eval { Intel::AMT::RemoteControl::run( $command ) }; |
eval { Intel::AMT::RemoteControl::run( $command ) }; |
79 |
CouchDB::audit( $command, { ip => $ENV{AMT_HOST}, error => $@ } ); |
store::audit( $command, { ip => $ENV{AMT_HOST}, error => $@ } ); |
80 |
warn "ERROR $@" if $@; |
warn "ERROR $@" if $@; |
81 |
} |
} |
82 |
|
|