line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Linux::Networks::iLO; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
115976026
|
use strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
80
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
67
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
389
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
140
|
|
7
|
1
|
|
|
1
|
|
416
|
use FusionInventory::Agent::Tools::Network; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
475
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
|
return canRun('hponcfg'); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _parseHponcfg { |
14
|
0
|
|
|
0
|
|
|
my (%params) = @_; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $handle = getFileHandle(%params); |
17
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
return unless $handle; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $interface = { |
21
|
|
|
|
|
|
|
DESCRIPTION => 'Management Interface - HP iLO', |
22
|
|
|
|
|
|
|
TYPE => 'ethernet', |
23
|
|
|
|
|
|
|
MANAGEMENT => 'iLO', |
24
|
|
|
|
|
|
|
STATUS => 'Down', |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
while (my $line = <$handle>) { |
28
|
0
|
0
|
|
|
|
|
if ($line =~ //) { |
29
|
0
|
0
|
|
|
|
|
$interface->{IPADDRESS} = $1 unless $1 eq '0.0.0.0'; |
30
|
|
|
|
|
|
|
} |
31
|
0
|
0
|
|
|
|
|
if ($line =~ //) { |
32
|
0
|
|
|
|
|
|
$interface->{IPMASK} = $1; |
33
|
|
|
|
|
|
|
} |
34
|
0
|
0
|
|
|
|
|
if ($line =~ //) { |
35
|
0
|
|
|
|
|
|
$interface->{IPGATEWAY} = $1; |
36
|
|
|
|
|
|
|
} |
37
|
0
|
0
|
|
|
|
|
if ($line =~ //) { |
38
|
0
|
|
|
|
|
|
$interface->{SPEED} = $1; |
39
|
|
|
|
|
|
|
} |
40
|
0
|
0
|
|
|
|
|
if ($line =~ //) { |
41
|
0
|
|
|
|
|
|
$interface->{STATUS} = 'Up'; |
42
|
|
|
|
|
|
|
} |
43
|
0
|
0
|
|
|
|
|
if ($line =~ /not found/) { |
44
|
0
|
|
|
|
|
|
chomp $line; |
45
|
0
|
0
|
|
|
|
|
$params{logger}->error("error in hponcfg output: $line") |
46
|
|
|
|
|
|
|
if $params{logger}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
close $handle; |
50
|
0
|
|
|
|
|
|
$interface->{IPSUBNET} = getSubnetAddress( |
51
|
|
|
|
|
|
|
$interface->{IPADDRESS}, $interface->{IPMASK} |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return $interface; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub doInventory { |
58
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
61
|
0
|
|
|
|
|
|
my $logger = $params{logger}; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
my $entry = _parseHponcfg( |
64
|
|
|
|
|
|
|
logger => $logger, |
65
|
|
|
|
|
|
|
command => 'hponcfg -aw -' |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
$inventory->addEntry( |
69
|
|
|
|
|
|
|
section => 'NETWORKS', |
70
|
|
|
|
|
|
|
entry => $entry |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |