Skip to content

Bug: Agent - Multiple Inventory Data Collection Errors (Windows & macOS) #1040

@Omareladawy

Description

@Omareladawy

Bug reporting acknowledgment

Yes, I read it

Professional support

Yes, I know

Describe the bug

Describe the bug
The GLPI Agent fails to collect, or collects incorrect/inconsistent data for various hardware components on both Windows and macOS systems.

1.1: Windows Systems
Processor Thread Count

Problem: The agent always writes the processor's number of threads as "2" for any processor.

Processor Clock Speed

Problem: Processor speed is often reported with wildly incorrect values in the GLPI dashboard (e.g., 40000 MHz, 9000 MHz).

Computer Type (Chassis)

Problem: The type for laptops is inconsistent. It is variously reported as "laptop," "notebook," or sometimes an incorrect identifier (e.g., "863E").

Memory Module Details

Problem: The agent sometimes reports memory type as a generic "physical memory" instead of getting the actual memory modules.

Observation: This sometimes corrects itself if you run the agent again, after which it writes the memory correctly (e.g., DDR4 - 3200 - SODIMM).

Storage Capacity and Device Mixing

Problem: In the components hard drive name (dashboard), USB flash drives are shown mixed with internal hard drives.

Observation: The total hard drive capacity incorrectly combines the flash drive with the internal storage. (e.g., if a flash drive is 64GB and internal storage is 250GB, it will be written as 314GB).

Integrated GPU VRAM

Problem: The agent doesn't always get the VRAM correctly for integrated graphics. For an Intel UHD 620, it got it once as 256MB and once as 1024MB.

Internal Laptop Display Detection

Problem: The agent did not register the laptop's display for 10 laptops at all (only for a Surface Laptop Go).

Observation: For one of the affected laptops, the monitor does show in the local inventory XML, but not in GLPI.

XML

AP///////wANrhwUAAAAABMdAQSVHxF4A+6Vo1RMmSYPUFQAAAABAQEBAQEBAQEBAQEBAQEBpDiA5nA4LEAwIKYANa0QAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAMJv8UPMgJBhTIAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== 19/2019 Chimei Innolux Corporation Generic PnP Monitor 00000000 External Monitor Detection (Perl Error & Deletion Issue)

Problem: An external monitor (Dell, connected via HDMI) was not registered, even though it is available in the local inventory XML.

Observation: This was related to the monitor being manually deleted from the asset. Because the monitor was not permanently deleted (emptied from the trash), running the inventory task multiple times failed to re-add it. After it was permanently deleted, the inventory task did add the monitor, but the following error still appears in the debug log:

Use of uninitialized value in string ne at E:/GLPI-Agent-1.15-x64/perl/agent/GLPI/Agent/Task/Inventory/Generic/Screen.pm line 368.
Use of uninitialized value in string ne at E:/GLPI-Agent-1.15-x64/perl/agent/GLPI/Agent/Task/Inventory/Generic/Screen.pm line 368.
XML Data (for the external monitor):

XML

AP///////wAQrNrQTDNHNjEdAQOANR546gVlp1ZSnCcPUFSlSwBxT4GAqcDRwAEBAQEBAQEBAjqAGHE4LUBYLEUADyghAAAeAAAA/wA0UzRGRloyCiAgICAgAAAA/ABERUxMIFAyNDE5SAogAAAA/QA4TB5TEQAKICAgICAgAfkCAxexTJAFBAMCBxYBFB8SE2UDDAAQAAI6gBhxOC1AWCxFAA8oIQAAHgEdgBhxHBYgWCwlAA8oIQAAngEdAHJR0B4gbihVAA8oIQAAHowK0Iog4C0QED6WAA8oIQAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPQ==

DELL P2419H 49/2019 Dell Inc. HDMI 4S4FFZ2 Monitor Size Detection

Problem: The agent does not get the display sizes (e.g., in inches).

Wi-Fi Adapter:

Problem: On the main computer asset dashboard, the Wi-Fi card is sometimes (but not always) written as a generic "network card item" or is left completely empty for some laptop models.

1.2: macOS Systems
Processor Speed (Apple Silicon)

Problem: For a MacBook Pro with an M2 Max, the processor speed is reported as "0 MHz."

Computer Type (Chassis)

Problem: The chassis type for a MacBook Pro was left empty.

Storage Detection (Apple Silicon)

Problem: On a MacBook Pro M2, the agent didn't register the internal storage at all. It only registered a connected flash drive and wrote the capacity of the hard drives as "0b".

Computer Model Name

Problem: The agent wrote the model of the MacBook Pro as Mac14,5. While not wrong (it's the Model Identifier), it's not user-friendly.

Battery Details

Problem: The agent did not register the battery's real capacity (health), cycle count, or original capacity for the MacBook.

CPU/GPU Core Details (Apple Silicon)

Problem: The agent does not register the detailed core breakdown for Apple M chips (e.g., 8 performance and 4 efficiency cores) or the number of GPU cores.

To reproduce

To Reproduce
Run the GLPI Agent inventory task on systems matching the descriptions:

Windows 10/11 laptops (e.g., with Intel UHD 620).

Windows laptops with external monitors.

MacBook Pro with Apple Silicon (e.g., M2 Max).

Observe the inventoried data in GLPI.

Expected behavior

Expected Behaviour
The agent should collect and report the correct hardware data.

Windows Fixes:

  1. Processor Threads and clock speed: The correct number of logical processors and clock speed should be reported. This can be fetched with:

PowerShell

Get-CimInstance Win32_Processor | Select-Object Name, NumberOfCores, NumberOfLogicalProcessors, MaxClockSpeed
3. Memory Details: The agent should always report specific module details. This can be fetched with:

PowerShell

Get-CimInstance Win32_PhysicalMemory | Select-Object Manufacturer, PartNumber, Capacity, Speed, BankLabel, DeviceLocator

  1. Storage Capacity: The agent should inventory internal storage separately from removable flash drives and not aggregate their capacities.

  2. GPU VRAM: VRAM should be reported consistently. This can be fetched with:

PowerShell

Get-CimInstance Win32_VideoController | Select-Object Name, AdapterRAM, DriverVersion
6 & 7. Monitors: All monitors (internal and external) present in the XML should be successfully inventoried without Perl errors.

  1. Monitor Size: Physical size (in inches) should be captured. This can be retrieved by parsing EDID data, using a script like the one below:

PowerShell

Parse EDID bytes helper

function Decode-EdidManufacturer([byte[]]$edid) {
    if ($edid.Length -lt 11) { return $null }
    $word = ($edid[8] -shl 8) -bor $edid[9]
    $c1 = [char]((($word -shr 10) -band 0x1F) + 64)
    $c2 = [char]((($word -shr 5)  -band 0x1F) + 64)
    $c3 = [char]((($word)        -band 0x1F) + 64)
    return "$c1$c2$c3"
}

Collect registry EDID entries

$edidEntries = Get-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Enum\DISPLAY' -ErrorAction SilentlyContinue |
 ForEach-Object {
    Get-ChildItem $.PSPath -ErrorAction SilentlyContinue |
    ForEach-Object {
        $instKey = $
.PSChildName
        $devicePath = "$($.PSPath)\Device Parameters"
        $edid = (Get-ItemProperty -Path $devicePath -Name EDID -ErrorAction SilentlyContinue).EDID
        if ($edid) {
            [PSCustomObject]@{
                InstanceId    = "$($
.PSParentPath.Split('\')[-1])$instKey"
                RegistryKey   = $_.PSPath
                EDID          = $edid
            }
        }
    }
}

Build final objects joining WMI and PnP

$result = foreach ($e in $edidEntries) {
    $edid = $e.EDID
    $hcm = if ($edid.Length -gt 21) { $edid[21] } else { $null }
    $vcm = if ($edid.Length -gt 22) { $edid[22] } else { $null }
    $inches = if ($hcm -and $vcm) { [math]::Round([math]::Sqrt([math]::Pow($hcm,2)+[math]::Pow($vcm,2))/2.54,1) } else { $null }
S
    $mfg = Decode-EdidManufacturer $edid
    $prod = if ($edid.Length -gt 11) { $edid[10] -bor ($edid[11] -shl 8) } else { $null }
    $serial = if ($edid.Length -gt 15) { ($edid[12] -bor ($edid[13] -shl 8) -bor ($edid[14] -shl 16) -bor ($edid[15] -shl 24)) } else { $null }

    $idPart = ($e.RegistryKey -split '\')[-2]
    $pnp = Get-PnpDevice -Class Monitor -ErrorAction SilentlyContinue |
           Where-Object { $_.InstanceId -like "$idPart" } |
           Select-Object -First 1

    $wmiMatch = Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorBasicDisplayParams -ErrorAction SilentlyContinue |
                Where-Object { $_.InstanceName -like "$idPart" } | Select-Object -First 1

    [PSCustomObject]@{
        RegistryInstance     = $e.InstanceId
        PnP_InstanceId       = if ($pnp) { $pnp.InstanceId } else { $null }
        FriendlyName         = if ($pnp) { $pnp.FriendlyName } else { $mfg + " " + $prod }
        ManufacturerCode     = $mfg
        ProductCode          = $prod
        SerialNumber        _ = $serial
        WidthCM              = $hcm
        HeightCM             = $vcm
        SizeInches           = $inches
        WMI_InstanceName     = if ($wmiMatch) { $wmiMatch.InstanceName } else { $null }
    }
}

$result | Sort-Object { if ($_.WMI_InstanceName) {0} else {1} } |
Select-Object RegistryInstance, PnP_InstanceId, FriendlyName, ManufacturerCode, ProductCode, SerialNumber, WidthCM, HeightCM, SizeInches, WMI_InstanceName

Script Output Example:

RegistryInstance : DELD0DA\5&2569878c&3&UID265
PnP_InstanceId : DISPLAY\DELD0DA\5&2569878C&3&UID265
FriendlyName : DELL P2419H(HDMI)
...
WidthCM : 53
HeightCM : 30
SizeInches : 24.1
...
RegistryInstance : CMN141C\5&2569878c&3&UID256
PnP_InstanceId : DISPLAY\CMN141C\5&2569878C&3&UID256
FriendlyName : Integrated Monitor
...
WidthCM : 31
HeightCM : 17
SizeInches : 14

9 - Wi-Fi Adapter: The dashboard column should consistently display the correct name of the Wi-Fi adapter or just say Wi-FI.

macOS Fixes:

  1. (macOS) Processor Speed: Should be left empty for Apple Silicon, not "0 MHz."

  2. (macOS) Computer Type: Should be "Laptop or Macbook" for MacBooks. This can be approximated with:

Bash

sys_type=$(system_profiler SPHardwareDataType | grep "Model Name" | awk -F': ' '{print $2}')
if [[ "$sys_type" == "MacBook" ]]; then
    echo "Type: Laptop"
else
    echo "Type: Desktop"
fi

  1. (macOS) Storage Detection: Internal Apple storage should be detected. This can be fetched with:

Bash

system_profiler SPStorageDataType

or

Bash

diskutil list internal

  1. (macOS) Computer Model Name: Should report the user-friendly Model Name or Model Number (e.g., MPHG3LL/A). This can be fetched with:

Bash

system_profiler SPHardwareDataType

  1. (macOS) Battery Details: Should inventory health, cycles, and original capacity. This can be fetched with:

Bash

system_profiler SPPowerDataType

  1. (macOS) CPU/GPU Cores: Should inventory performance/efficiency cores and GPU cores. This can be fetched with:

Bash

For CPU Cores

system_profiler SPHardwareDataType

For GPU Cores

system_profiler SPDisplaysDataType

Operating system

Windows, MacOSX

GLPI Agent version

v1.15

GLPI version

Other (Details in additional context below)

GLPIInventory plugin or other plugin version

GLPI Inventory v1.5.3

Additional context

I wrote the bug report myself, I found the solutions and organized the report with the help of AI.

I'm willing to help in anyway and get any required information to help the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions