feat(audit): 1.3 — CPU collector (dmidecode type 4, microcode)

- cpu.go: collectCPUs(), parseCPUs(), parseCPUSection()
- splitDMISections(): splits multi-section dmidecode output generically
- parseFieldLines(): reusable key→value parser for DMI sections
- parseCPUStatus(): Populated/Unpopulated → OK/WARNING/EMPTY/UNKNOWN
- parseSocketIndex(): CPU0/Processor 1/Socket 2 → integer
- cleanManufacturer(): strips (R), Corporation, Inc. suffixes
- parseMHz(), parseInt(): field value parsers
- Serial fallback: <board_serial>-CPU-<socket> when DMI serial absent
- readMicrocode(): /sys/devices/system/cpu/cpu0/microcode/version
- cpu_test.go: dual-socket, unpopulated skipped, status, socket, manufacturer, MHz

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 10:37:19 +03:00
parent f1e392a7fe
commit 00bb2fdace
5 changed files with 484 additions and 1 deletions

View File

@@ -0,0 +1,66 @@
# dmidecode 3.5
Getting SMBIOS data from sysfs.
SMBIOS 3.1.1 present.
Handle 0x0004, DMI type 4, 48 bytes
Processor Information
Socket Designation: CPU0
Type: Central Processor
Family: Xeon
Manufacturer: Intel(R) Corporation
ID: F7 06 08 00 FF FB EB BF
Signature: Type 0, Family 6, Model 143, Stepping 7
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
Version: Intel(R) Xeon(R) Gold 6530
Voltage: 1.6 V
External Clock: 100 MHz
Max Speed: 4000 MHz
Current Speed: 2100 MHz
Status: Populated, Enabled
Upgrade: Other
L1 Cache Handle: 0x0006
L2 Cache Handle: 0x0007
L3 Cache Handle: 0x0008
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 32
Core Enabled: 32
Thread Count: 64
Characteristics:
64-bit capable
Multi-Core
Hardware Thread
Handle 0x0005, DMI type 4, 48 bytes
Processor Information
Socket Designation: CPU1
Type: Central Processor
Family: Xeon
Manufacturer: Intel(R) Corporation
ID: F7 06 08 00 FF FB EB BF
Signature: Type 0, Family 6, Model 143, Stepping 7
Flags:
FPU (Floating-point unit on-chip)
Version: Intel(R) Xeon(R) Gold 6530
Voltage: 1.6 V
External Clock: 100 MHz
Max Speed: 4000 MHz
Current Speed: 2100 MHz
Status: Populated, Enabled
Upgrade: Other
L1 Cache Handle: 0x000A
L2 Cache Handle: 0x000B
L3 Cache Handle: 0x000C
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 32
Core Enabled: 32
Thread Count: 64
Characteristics:
64-bit capable
Multi-Core

View File

@@ -0,0 +1,31 @@
# dmidecode 3.5
Getting SMBIOS data from sysfs.
SMBIOS 3.1.1 present.
Handle 0x0004, DMI type 4, 48 bytes
Processor Information
Socket Designation: CPU0
Type: Central Processor
Family: Xeon
Manufacturer: Intel(R) Corporation
Version: Intel(R) Xeon(R) Gold 6530
Max Speed: 4000 MHz
Current Speed: 2100 MHz
Status: Populated, Enabled
Serial Number: Not Specified
Core Count: 32
Thread Count: 64
Handle 0x0005, DMI type 4, 48 bytes
Processor Information
Socket Designation: CPU1
Type: Central Processor
Family: Unknown
Manufacturer: Unknown
Version: Unknown
Max Speed: Unknown
Current Speed: Unknown
Status: Unpopulated
Serial Number: Not Specified
Core Count: N/A
Thread Count: N/A