line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Tools::HPUX; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
10557110
|
use strict; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
212
|
|
4
|
7
|
|
|
7
|
|
41
|
use warnings; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
252
|
|
5
|
7
|
|
|
7
|
|
33
|
use base 'Exporter'; |
|
7
|
|
|
|
|
87
|
|
|
7
|
|
|
|
|
737
|
|
6
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
788
|
use English qw(-no_match_vars); |
|
7
|
|
|
|
|
4253
|
|
|
7
|
|
|
|
|
63
|
|
8
|
|
|
|
|
|
|
|
9
|
7
|
|
|
7
|
|
5099
|
use FusionInventory::Agent::Tools; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
1282
|
|
10
|
7
|
|
|
7
|
|
37
|
use Memoize; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
3257
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw( |
13
|
|
|
|
|
|
|
getInfoFromMachinfo |
14
|
|
|
|
|
|
|
isHPVMGuest |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
memoize('getInfoFromMachinfo'); |
18
|
|
|
|
|
|
|
memoize('isHPVMGuest'); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub getInfoFromMachinfo { |
21
|
|
|
|
|
|
|
my (%params) = ( |
22
|
|
|
|
|
|
|
command => '/usr/contrib/bin/machinfo', |
23
|
|
|
|
|
|
|
@_ |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $handle = getFileHandle(%params); |
27
|
|
|
|
|
|
|
return unless $handle; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $info; |
30
|
|
|
|
|
|
|
my $current; |
31
|
|
|
|
|
|
|
while (my $line = <$handle>) { |
32
|
|
|
|
|
|
|
chomp $line; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#key: value |
35
|
|
|
|
|
|
|
if ($line =~ /^ (\S [^:]+) : \s+ (.*\S)/x) { |
36
|
|
|
|
|
|
|
$info->{$1} = $2; |
37
|
|
|
|
|
|
|
next; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# key: value |
41
|
|
|
|
|
|
|
if ($line =~ /^ \s+ (\S [^:]+) : \s+ (.*\S)/x) { |
42
|
|
|
|
|
|
|
$info->{$current}->{lc($1)} = $2; |
43
|
|
|
|
|
|
|
next; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# key = value |
47
|
|
|
|
|
|
|
if ($line =~ /^ \s+ (\S [^=]+) \s+ = \s+ (.*\S)/x) { |
48
|
|
|
|
|
|
|
$info->{$current}->{lc($1)} = $2; |
49
|
|
|
|
|
|
|
next; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# value |
53
|
|
|
|
|
|
|
if ($line =~ /^ \s+ (.*\S)/x) { |
54
|
|
|
|
|
|
|
# hack for CPUinfo: |
55
|
|
|
|
|
|
|
# accumulate new lines if current node is not an hash |
56
|
|
|
|
|
|
|
if ($info->{$current}) { |
57
|
|
|
|
|
|
|
$info->{$current} .= " $1" if ! ref $info->{$current}; |
58
|
|
|
|
|
|
|
} else { |
59
|
|
|
|
|
|
|
$info->{$current} = $1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
next; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#key: |
65
|
|
|
|
|
|
|
if ($line =~ /^ (\S [^:]+) :$/x) { |
66
|
|
|
|
|
|
|
$current = $1; |
67
|
|
|
|
|
|
|
next; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
close $handle; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
return $info; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub isHPVMGuest { |
76
|
|
|
|
|
|
|
return getFirstMatch( |
77
|
|
|
|
|
|
|
command => 'hpvminfo', |
78
|
|
|
|
|
|
|
pattern => qr/HPVM guest/ |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
__END__ |