From 1d282c419621635679475403b60ff0946880ffb3 Mon Sep 17 00:00:00 2001 From: Michael Chus Date: Sat, 28 Feb 2026 14:54:55 +0300 Subject: [PATCH] collector/redfish: collect and parse platform model fallback --- internal/collector/redfish.go | 14 +++++++++++++- internal/collector/redfish_replay.go | 12 ++++++++++-- internal/collector/redfish_test.go | 2 +- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/internal/collector/redfish.go b/internal/collector/redfish.go index 433f458..27c5da3 100644 --- a/internal/collector/redfish.go +++ b/internal/collector/redfish.go @@ -964,7 +964,10 @@ func redfishCriticalEndpoints(systemPaths, chassisPaths, managerPaths []string) add(p) add(joinPath(p, "/Bios")) add(joinPath(p, "/SecureBoot")) + add(joinPath(p, "/Oem/Public")) add(joinPath(p, "/Oem/Public/FRU")) + add(joinPath(p, "/Oem/Public/ThermalConfig")) + add(joinPath(p, "/ThermalConfig")) add(joinPath(p, "/Processors")) add(joinPath(p, "/Memory")) add(joinPath(p, "/Storage")) @@ -977,7 +980,10 @@ func redfishCriticalEndpoints(systemPaths, chassisPaths, managerPaths []string) } for _, p := range chassisPaths { add(p) + add(joinPath(p, "/Oem/Public")) add(joinPath(p, "/Oem/Public/FRU")) + add(joinPath(p, "/Oem/Public/ThermalConfig")) + add(joinPath(p, "/ThermalConfig")) add(joinPath(p, "/Power")) add(joinPath(p, "/Thermal")) add(joinPath(p, "/Sensors")) @@ -1497,7 +1503,7 @@ func parseBoardInfoFromFRUDoc(doc map[string]interface{}) models.BoardInfo { } return models.BoardInfo{ Manufacturer: findFirstNormalizedStringByKeys(doc, "Manufacturer", "BoardManufacturer", "Vendor"), - ProductName: findFirstNormalizedStringByKeys(doc, "ProductName", "BoardName", "Model"), + ProductName: findFirstNormalizedStringByKeys(doc, "ProductName", "BoardName", "PlatformId", "PlatformName", "MachineTypeModel", "Model"), SerialNumber: findFirstNormalizedStringByKeys(doc, "SerialNumber", "BoardSerialNumber"), PartNumber: findFirstNormalizedStringByKeys(doc, "PartNumber", "BoardPartNumber", "ProductPartNumber"), } @@ -2632,7 +2638,10 @@ func redfishSnapshotPrioritySeeds(systemPaths, chassisPaths, managerPaths []stri add(p) add(joinPath(p, "/Bios")) add(joinPath(p, "/SecureBoot")) + add(joinPath(p, "/Oem/Public")) add(joinPath(p, "/Oem/Public/FRU")) + add(joinPath(p, "/Oem/Public/ThermalConfig")) + add(joinPath(p, "/ThermalConfig")) add(joinPath(p, "/Processors")) add(joinPath(p, "/Memory")) add(joinPath(p, "/EthernetInterfaces")) @@ -2651,7 +2660,10 @@ func redfishSnapshotPrioritySeeds(systemPaths, chassisPaths, managerPaths []stri } for _, p := range chassisPaths { add(p) + add(joinPath(p, "/Oem/Public")) add(joinPath(p, "/Oem/Public/FRU")) + add(joinPath(p, "/Oem/Public/ThermalConfig")) + add(joinPath(p, "/ThermalConfig")) add(joinPath(p, "/Sensors")) add(joinPath(p, "/HealthSummary")) add(joinPath(p, "/ThresholdSensors")) diff --git a/internal/collector/redfish_replay.go b/internal/collector/redfish_replay.go index 3be2ce0..224ecbc 100644 --- a/internal/collector/redfish_replay.go +++ b/internal/collector/redfish_replay.go @@ -56,7 +56,7 @@ func ReplayRedfishFromRawPayloads(rawPayloads map[string]any, emit ProgressFn) ( if len(fruDoc) == 0 { fruDoc = chassisFRUDoc } - boardFallbackDocs := r.collectBoardFallbackDocs(chassisPaths) + boardFallbackDocs := r.collectBoardFallbackDocs(systemPaths, chassisPaths) if emit != nil { emit(Progress{Status: "running", Progress: 55, Message: "Redfish snapshot: replay CPU/RAM/Storage..."}) @@ -445,7 +445,7 @@ func dedupeStrings(items []string) []string { return out } -func (r redfishSnapshotReader) collectBoardFallbackDocs(chassisPaths []string) []map[string]interface{} { +func (r redfishSnapshotReader) collectBoardFallbackDocs(systemPaths, chassisPaths []string) []map[string]interface{} { out := make([]map[string]interface{}, 0) for _, chassisPath := range chassisPaths { for _, suffix := range []string{"/Boards", "/Backplanes"} { @@ -459,6 +459,14 @@ func (r redfishSnapshotReader) collectBoardFallbackDocs(chassisPaths []string) [ } } } + for _, path := range append(append([]string{}, systemPaths...), chassisPaths...) { + for _, suffix := range []string{"/Oem/Public", "/Oem/Public/ThermalConfig", "/ThermalConfig"} { + docPath := joinPath(path, suffix) + if doc, err := r.getJSON(docPath); err == nil && len(doc) > 0 { + out = append(out, doc) + } + } + } return out } diff --git a/internal/collector/redfish_test.go b/internal/collector/redfish_test.go index 178597b..5ee923f 100644 --- a/internal/collector/redfish_test.go +++ b/internal/collector/redfish_test.go @@ -705,7 +705,7 @@ func TestApplyBoardInfoFallbackFromDocs_SkipsComponentProductNames(t *testing.T) "SerialNumber": "802C1A2507D284B001", }, { - "ProductName": "NF5688M7", + "PlatformId": "NF5688M7", "Manufacturer": "Inspur", "PartNumber": "YZMB-00001", },