line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Linux::Networks::iLO; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
120036260
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
68
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
75
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
469
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
249
|
|
7
|
2
|
|
|
2
|
|
703
|
use FusionInventory::Agent::Tools::Network; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
906
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
0
|
return canRun('hponcfg'); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _parseHponcfg { |
14
|
2
|
|
|
2
|
|
326
|
my (%params) = @_; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
8
|
my $handle = getFileHandle(%params); |
17
|
|
|
|
|
|
|
|
18
|
2
|
50
|
|
|
|
5
|
return unless $handle; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
7
|
my $interface = { |
21
|
|
|
|
|
|
|
DESCRIPTION => 'Management Interface - HP iLO', |
22
|
|
|
|
|
|
|
TYPE => 'ethernet', |
23
|
|
|
|
|
|
|
MANAGEMENT => 'iLO', |
24
|
|
|
|
|
|
|
STATUS => 'Down', |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
24
|
while (my $line = <$handle>) { |
28
|
127
|
100
|
|
|
|
249
|
if ($line =~ //) { |
29
|
1
|
50
|
|
|
|
4
|
$interface->{IPADDRESS} = $1 unless $1 eq '0.0.0.0'; |
30
|
|
|
|
|
|
|
} |
31
|
127
|
100
|
|
|
|
203
|
if ($line =~ //) { |
32
|
1
|
|
|
|
|
2
|
$interface->{IPMASK} = $1; |
33
|
|
|
|
|
|
|
} |
34
|
127
|
100
|
|
|
|
221
|
if ($line =~ //) { |
35
|
1
|
|
|
|
|
3
|
$interface->{IPGATEWAY} = $1; |
36
|
|
|
|
|
|
|
} |
37
|
127
|
100
|
|
|
|
144
|
if ($line =~ //) { |
38
|
1
|
|
|
|
|
3
|
$interface->{SPEED} = $1; |
39
|
|
|
|
|
|
|
} |
40
|
127
|
100
|
|
|
|
140
|
if ($line =~ //) { |
41
|
1
|
|
|
|
|
2
|
$interface->{STATUS} = 'Up'; |
42
|
|
|
|
|
|
|
} |
43
|
127
|
100
|
|
|
|
277
|
if ($line =~ /not found/) { |
44
|
1
|
|
|
|
|
2
|
chomp $line; |
45
|
|
|
|
|
|
|
$params{logger}->error("error in hponcfg output: $line") |
46
|
1
|
50
|
|
|
|
6
|
if $params{logger}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
2
|
|
|
|
|
11
|
close $handle; |
50
|
|
|
|
|
|
|
$interface->{IPSUBNET} = getSubnetAddress( |
51
|
|
|
|
|
|
|
$interface->{IPADDRESS}, $interface->{IPMASK} |
52
|
2
|
|
|
|
|
8
|
); |
53
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
25
|
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; |