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