/usr/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Win32/Memory.pm is in fusioninventory-agent 1:2.3.10.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | package FusionInventory::Agent::Task::Inventory::Win32::Memory;
use strict;
use warnings;
use FusionInventory::Agent::Tools::Win32;
our $runMeIfTheseChecksFailed =
["FusionInventory::Agent::Task::Inventory::Generic::Dmidecode"];
my @formFactorVal = qw/
Unknown
Other
SIP
DIP
ZIP
SOJ
Proprietary
SIMM
DIMM
TSOP
PGA
RIMM
SODIMM
SRIMM
SMD
SSMP
QFP
TQFP
SOIC
LCC
PLCC
BGA
FPBGA
LGA
/;
my @memoryTypeVal = qw/
Unknown
Other
DRAM
Synchronous DRAM
Cache DRAM
EDO
EDRAM
VRAM
SRAM
RAM
ROM
Flash
EEPROM
FEPROM
EPROM
CDRAM
3DRAM
SDRAM
SGRAM
RDRAM
DDR
DDR-2
/;
my @memoryErrorProtection = (
undef,
'Other',
undef,
'None',
'Parity',
'Single-bit ECC',
'Multi-bit ECC',
'CRC',
);
sub isEnabled {
return 1;
}
sub doInventory {
my (%params) = @_;
my $inventory = $params{inventory};
foreach my $memory (_getMemories()) {
$inventory->addEntry(
section => 'MEMORIES',
entry => $memory
);
}
}
sub _getMemories {
my $cpt = 0;
my @memories;
foreach my $object (getWMIObjects(
class => 'Win32_PhysicalMemory',
properties => [ qw/
Capacity Caption Description FormFactor Removable Speed MemoryType
SerialNumber
/ ]
)) {
# Ignore ROM storages (BIOS ROM)
my $type = $memoryTypeVal[$object->{MemoryType}];
next if $type && $type eq 'ROM';
next if $type && $type eq 'Flash';
my $capacity;
$capacity = $object->{Capacity} / (1024 * 1024)
if $object->{Capacity};
push @memories, {
CAPACITY => $capacity,
CAPTION => $object->{Caption},
DESCRIPTION => $object->{Description},
FORMFACTOR => $formFactorVal[$object->{FormFactor}],
REMOVABLE => $object->{Removable} ? 1 : 0,
SPEED => $object->{Speed},
TYPE => $memoryTypeVal[$object->{MemoryType}],
NUMSLOTS => $cpt++,
SERIALNUMBER => $object->{SerialNumber}
}
}
foreach my $object (getWMIObjects(
class => 'Win32_PhysicalMemoryArray',
properties => [ qw/
MemoryDevices SerialNumber PhysicalMemoryCorrection
/ ]
)) {
my $memory = $memories[$object->{MemoryDevices} - 1];
if (!$memory->{SERIALNUMBER}) {
$memory->{SERIALNUMBER} = $object->{SerialNumber};
}
if ($object->{PhysicalMemoryCorrection}) {
$memory->{MEMORYCORRECTION} =
$memoryErrorProtection[$object->{PhysicalMemoryCorrection}];
}
if ($memory->{MEMORYCORRECTION}) {
$memory->{DESCRIPTION} .= " (".$memory->{MEMORYCORRECTION}.")";
}
}
return @memories;
}
1;
|