v1.1.0: Parser versioning, server info, auto-browser, section overviews
- Add parser versioning with Version() method and version display on main screen - Add server model and serial number to Configuration tab and TXT export - Add auto-browser opening on startup with --no-browser flag - Add Restart and Exit buttons with graceful shutdown - Add section overview stats (CPU, Power, Storage, GPU, Network) - Change PCIe Link display to "x16 PCIe Gen4" format - Add Location column to Serials section - Extract BoardInfo from FRU and PlatformId from ThermalConfig Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
68
internal/parser/vendors/inspur/fru.go
vendored
68
internal/parser/vendors/inspur/fru.go
vendored
@@ -9,8 +9,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
fruDeviceRegex = regexp.MustCompile(`^FRU Device Description\s*:\s*(.+)$`)
|
||||
fruFieldRegex = regexp.MustCompile(`^\s+(.+?)\s*:\s*(.*)$`)
|
||||
fruDeviceRegex = regexp.MustCompile(`^FRU Device Description\s*:\s*(.+)$`)
|
||||
fruFieldRegex = regexp.MustCompile(`^\s+(.+?)\s*:\s*(.*)$`)
|
||||
platformIdRegex = regexp.MustCompile(`(?i)PlatformId\s*=\s*(\S+)`)
|
||||
)
|
||||
|
||||
// ParseFRU parses BMC FRU (Field Replaceable Unit) output
|
||||
@@ -95,3 +96,66 @@ func ParseFRU(content []byte) []models.FRUInfo {
|
||||
|
||||
return fruList
|
||||
}
|
||||
|
||||
// extractBoardInfo extracts main board/chassis information from FRU data
|
||||
func extractBoardInfo(fruList []models.FRUInfo, hw *models.HardwareConfig) {
|
||||
if hw == nil || len(fruList) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// Look for the main board/chassis FRU entry
|
||||
// Usually it's the first entry or one with "Builtin FRU" or containing board info
|
||||
for _, fru := range fruList {
|
||||
// Skip empty entries
|
||||
if fru.ProductName == "" && fru.SerialNumber == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
// Prioritize entries that look like main board info
|
||||
desc := strings.ToLower(fru.Description)
|
||||
isMainBoard := strings.Contains(desc, "builtin") ||
|
||||
strings.Contains(desc, "fru device") ||
|
||||
strings.Contains(desc, "chassis") ||
|
||||
strings.Contains(desc, "board")
|
||||
|
||||
// If we haven't set board info yet, or this is a main board entry
|
||||
if hw.BoardInfo.ProductName == "" || isMainBoard {
|
||||
if fru.ProductName != "" {
|
||||
hw.BoardInfo.ProductName = fru.ProductName
|
||||
}
|
||||
if fru.SerialNumber != "" {
|
||||
hw.BoardInfo.SerialNumber = fru.SerialNumber
|
||||
}
|
||||
if fru.Manufacturer != "" {
|
||||
hw.BoardInfo.Manufacturer = fru.Manufacturer
|
||||
}
|
||||
if fru.PartNumber != "" {
|
||||
hw.BoardInfo.PartNumber = fru.PartNumber
|
||||
}
|
||||
|
||||
// If we found a main board entry, stop searching
|
||||
if isMainBoard && fru.ProductName != "" && fru.SerialNumber != "" {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// extractPlatformId extracts server model from ThermalConfig (PlatformId)
|
||||
func extractPlatformId(content []byte, hw *models.HardwareConfig) {
|
||||
if hw == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if match := platformIdRegex.FindSubmatch(content); match != nil {
|
||||
platformId := strings.TrimSpace(string(match[1]))
|
||||
if platformId != "" {
|
||||
// Set as ProductName (server model) - this takes priority over FRU data
|
||||
hw.BoardInfo.ProductName = platformId
|
||||
// Also set manufacturer as Inspur if not already set
|
||||
if hw.BoardInfo.Manufacturer == "" {
|
||||
hw.BoardInfo.Manufacturer = "Inspur"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
29
internal/parser/vendors/inspur/parser.go
vendored
29
internal/parser/vendors/inspur/parser.go
vendored
@@ -1,5 +1,8 @@
|
||||
// Package inspur provides parser for Inspur/Kaytus BMC diagnostic archives
|
||||
// Tested with: Kaytus KR4268X2 (onekeylog format)
|
||||
// Tested with: Inspur NF5468M7 / Kaytus KR4268X2 (onekeylog format)
|
||||
//
|
||||
// IMPORTANT: Increment parserVersion when modifying parser logic!
|
||||
// This helps track which version was used to parse specific logs.
|
||||
package inspur
|
||||
|
||||
import (
|
||||
@@ -9,6 +12,10 @@ import (
|
||||
"git.mchus.pro/mchus/logpile/internal/parser"
|
||||
)
|
||||
|
||||
// parserVersion - version of this parser module
|
||||
// IMPORTANT: Increment this version when making changes to parser logic!
|
||||
const parserVersion = "1.0.0"
|
||||
|
||||
func init() {
|
||||
parser.Register(&Parser{})
|
||||
}
|
||||
@@ -26,6 +33,12 @@ func (p *Parser) Vendor() string {
|
||||
return "inspur"
|
||||
}
|
||||
|
||||
// Version returns parser version
|
||||
// IMPORTANT: Update parserVersion constant when modifying parser logic!
|
||||
func (p *Parser) Version() string {
|
||||
return parserVersion
|
||||
}
|
||||
|
||||
// Detect checks if archive matches Inspur/Kaytus format
|
||||
// Returns confidence 0-100
|
||||
func (p *Parser) Detect(files []parser.ExtractedFile) int {
|
||||
@@ -90,11 +103,19 @@ func (p *Parser) Parse(files []parser.ExtractedFile) (*models.AnalysisResult, er
|
||||
}
|
||||
}
|
||||
|
||||
// Extract BoardInfo from FRU data
|
||||
if result.Hardware == nil {
|
||||
result.Hardware = &models.HardwareConfig{}
|
||||
}
|
||||
extractBoardInfo(result.FRU, result.Hardware)
|
||||
|
||||
// Extract PlatformId (server model) from ThermalConfig
|
||||
if f := parser.FindFileByName(files, "ThermalConfig_Cur.conf"); f != nil {
|
||||
extractPlatformId(f.Content, result.Hardware)
|
||||
}
|
||||
|
||||
// Parse component.log for additional data (PSU, etc.)
|
||||
if f := parser.FindFileByName(files, "component.log"); f != nil {
|
||||
if result.Hardware == nil {
|
||||
result.Hardware = &models.HardwareConfig{}
|
||||
}
|
||||
ParseComponentLog(f.Content, result.Hardware)
|
||||
|
||||
// Extract events from component.log (memory errors, etc.)
|
||||
|
||||
Reference in New Issue
Block a user