line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::AIX::Memory; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
105114594
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
122
|
|
4
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
141
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1076
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
404
|
|
7
|
2
|
|
|
2
|
|
1202
|
use FusionInventory::Agent::Tools::AIX; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
974
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
11
|
0
|
0
|
|
|
|
0
|
return 0 if $params{no_category}->{memory}; |
12
|
0
|
|
|
|
|
0
|
return 1; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub doInventory { |
16
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
19
|
0
|
|
|
|
|
0
|
my $logger = $params{logger}; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
0
|
foreach my $memory (_getMemories()) { |
22
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
23
|
|
|
|
|
|
|
section => 'MEMORIES', |
24
|
|
|
|
|
|
|
entry => $memory |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#Memory informations |
29
|
|
|
|
|
|
|
#lsdev -Cc memory -F 'name' -t totmem |
30
|
|
|
|
|
|
|
#lsattr -EOlmem0 |
31
|
0
|
|
|
|
|
0
|
my $memorySize = 0; |
32
|
0
|
|
|
|
|
0
|
my @lsdev = getAllLines( |
33
|
|
|
|
|
|
|
command => 'lsdev -Cc memory -F "name" -t totmem', |
34
|
|
|
|
|
|
|
logger => $logger |
35
|
|
|
|
|
|
|
); |
36
|
0
|
|
|
|
|
0
|
foreach (@lsdev){ |
37
|
0
|
|
|
|
|
0
|
my @lsattr = getAllLines( |
38
|
|
|
|
|
|
|
command => "lsattr -EOl $_", |
39
|
|
|
|
|
|
|
logger => $logger |
40
|
|
|
|
|
|
|
); |
41
|
0
|
|
|
|
|
0
|
foreach (@lsattr) { |
42
|
0
|
0
|
|
|
|
0
|
if (! /^#/){ |
43
|
|
|
|
|
|
|
# See: http://forge.fusioninventory.org/issues/399 |
44
|
|
|
|
|
|
|
# TODO: the regex should be improved here |
45
|
0
|
|
|
|
|
0
|
/^(.+):(\d+)/; |
46
|
0
|
|
|
|
|
0
|
$memorySize += $2; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#Paging Space |
52
|
0
|
|
|
|
|
0
|
my $swapSize; |
53
|
0
|
|
|
|
|
0
|
my @grep = getAllLines(command => 'lsps -s', logger => $logger); |
54
|
0
|
|
|
|
|
0
|
foreach (@grep){ |
55
|
0
|
0
|
|
|
|
0
|
if ( ! /^Total/){ |
56
|
0
|
|
|
|
|
0
|
/^\s*(\d+)\w*\s+\d+.+/; |
57
|
0
|
|
|
|
|
0
|
$swapSize = $1; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
$inventory->setHardware({ |
62
|
0
|
|
|
|
|
0
|
MEMORY => $memorySize, |
63
|
|
|
|
|
|
|
SWAP => $swapSize |
64
|
|
|
|
|
|
|
}); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _getMemories { |
69
|
5
|
|
|
5
|
|
1259
|
my @infos = getLsvpdInfos(@_); |
70
|
5
|
|
|
|
|
68
|
my @memories; |
71
|
5
|
|
|
|
|
8
|
my $numslots = 0; |
72
|
|
|
|
|
|
|
|
73
|
5
|
|
|
|
|
10
|
foreach my $info (@infos) { |
74
|
167
|
100
|
|
|
|
363
|
next unless $info->{DS} eq 'Memory DIMM'; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
push @memories, { |
77
|
|
|
|
|
|
|
DESCRIPTION => $info->{DS}, |
78
|
|
|
|
|
|
|
CAPACITY => $info->{SZ}, |
79
|
|
|
|
|
|
|
CAPTION => 'Slot ' . $info->{YL}, |
80
|
|
|
|
|
|
|
SERIALNUMBER=> $info->{SN}, |
81
|
34
|
|
|
|
|
175
|
NUMSLOTS => $numslots++ |
82
|
|
|
|
|
|
|
}; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
5
|
|
|
|
|
25
|
return @memories; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |