Add LOGPile BMC diagnostic log analyzer

Features:
- Modular parser architecture for vendor-specific formats
- Inspur/Kaytus parser supporting asset.json, devicefrusdr.log,
  component.log, idl.log, and syslog files
- PCI Vendor/Device ID lookup for hardware identification
- Web interface with tabs: Events, Sensors, Config, Serials, Firmware
- Server specification summary with component grouping
- Export to CSV, JSON, TXT formats
- BMC alarm parsing from IDL logs (memory errors, PSU events, etc.)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-25 04:11:23 +03:00
parent fb800216f1
commit 512957545a
29 changed files with 4086 additions and 1 deletions

159
internal/models/models.go Normal file
View File

@@ -0,0 +1,159 @@
package models
import "time"
// AnalysisResult contains all parsed data from an archive
type AnalysisResult struct {
Filename string `json:"filename"`
Events []Event `json:"events"`
FRU []FRUInfo `json:"fru"`
Sensors []SensorReading `json:"sensors"`
Hardware *HardwareConfig `json:"hardware"`
}
// Event represents a single log event
type Event struct {
ID string `json:"id"`
Timestamp time.Time `json:"timestamp"`
Source string `json:"source"`
SensorType string `json:"sensor_type"`
SensorName string `json:"sensor_name"`
EventType string `json:"event_type"`
Severity Severity `json:"severity"`
Description string `json:"description"`
RawData string `json:"raw_data,omitempty"`
}
// Severity represents event severity level
type Severity string
const (
SeverityCritical Severity = "critical"
SeverityWarning Severity = "warning"
SeverityInfo Severity = "info"
)
// SensorReading represents a single sensor reading
type SensorReading struct {
Name string `json:"name"`
Type string `json:"type"`
Value float64 `json:"value,omitempty"`
Unit string `json:"unit,omitempty"`
RawValue string `json:"raw_value,omitempty"`
Status string `json:"status"`
}
// FRUInfo represents Field Replaceable Unit information
type FRUInfo struct {
DeviceID string `json:"device_id,omitempty"`
Description string `json:"description"`
ChassisType string `json:"chassis_type,omitempty"`
Manufacturer string `json:"manufacturer,omitempty"`
ProductName string `json:"product_name,omitempty"`
SerialNumber string `json:"serial_number,omitempty"`
PartNumber string `json:"part_number,omitempty"`
Version string `json:"version,omitempty"`
MfgDate string `json:"mfg_date,omitempty"`
AssetTag string `json:"asset_tag,omitempty"`
}
// HardwareConfig represents server hardware configuration
type HardwareConfig struct {
Firmware []FirmwareInfo `json:"firmware,omitempty"`
BoardInfo BoardInfo `json:"board,omitempty"`
CPUs []CPU `json:"cpus,omitempty"`
Memory []MemoryDIMM `json:"memory,omitempty"`
Storage []Storage `json:"storage,omitempty"`
PCIeDevices []PCIeDevice `json:"pcie_devices,omitempty"`
NetworkCards []NIC `json:"network_cards,omitempty"`
PowerSupply []PSU `json:"power_supplies,omitempty"`
}
// FirmwareInfo represents firmware version information
type FirmwareInfo struct {
DeviceName string `json:"device_name"`
Version string `json:"version"`
BuildTime string `json:"build_time,omitempty"`
}
// BoardInfo represents motherboard information
type BoardInfo struct {
Manufacturer string `json:"manufacturer,omitempty"`
ProductName string `json:"product_name,omitempty"`
SerialNumber string `json:"serial_number,omitempty"`
PartNumber string `json:"part_number,omitempty"`
}
// CPU represents processor information
type CPU struct {
Socket int `json:"socket"`
Model string `json:"model"`
Cores int `json:"cores"`
Threads int `json:"threads"`
FrequencyMHz int `json:"frequency_mhz"`
MaxFreqMHz int `json:"max_frequency_mhz,omitempty"`
L1CacheKB int `json:"l1_cache_kb,omitempty"`
L2CacheKB int `json:"l2_cache_kb,omitempty"`
L3CacheKB int `json:"l3_cache_kb,omitempty"`
TDP int `json:"tdp_w,omitempty"`
PPIN string `json:"ppin,omitempty"`
SerialNumber string `json:"serial_number,omitempty"`
}
// MemoryDIMM represents a memory module
type MemoryDIMM struct {
Slot int `json:"slot"`
SizeMB int `json:"size_mb"`
Type string `json:"type"`
SpeedMHz int `json:"speed_mhz"`
Manufacturer string `json:"manufacturer,omitempty"`
SerialNumber string `json:"serial_number,omitempty"`
PartNumber string `json:"part_number,omitempty"`
}
// Storage represents a storage device
type Storage struct {
Slot string `json:"slot"`
Type string `json:"type"`
Model string `json:"model"`
SizeGB int `json:"size_gb"`
SerialNumber string `json:"serial_number,omitempty"`
Manufacturer string `json:"manufacturer,omitempty"`
Firmware string `json:"firmware,omitempty"`
Interface string `json:"interface,omitempty"`
}
// PCIeDevice represents a PCIe device
type PCIeDevice struct {
Slot string `json:"slot"`
VendorID int `json:"vendor_id"`
DeviceID int `json:"device_id"`
BDF string `json:"bdf"`
DeviceClass string `json:"device_class"`
Manufacturer string `json:"manufacturer,omitempty"`
LinkWidth int `json:"link_width"`
LinkSpeed string `json:"link_speed"`
MaxLinkWidth int `json:"max_link_width"`
MaxLinkSpeed string `json:"max_link_speed"`
PartNumber string `json:"part_number,omitempty"`
SerialNumber string `json:"serial_number,omitempty"`
MACAddresses []string `json:"mac_addresses,omitempty"`
}
// NIC represents a network interface card
type NIC struct {
Name string `json:"name"`
Model string `json:"model"`
MACAddress string `json:"mac_address"`
SpeedMbps int `json:"speed_mbps,omitempty"`
SerialNumber string `json:"serial_number,omitempty"`
}
// PSU represents a power supply unit
type PSU struct {
Slot string `json:"slot"`
Model string `json:"model"`
WattageW int `json:"wattage_w,omitempty"`
SerialNumber string `json:"serial_number,omitempty"`
Status string `json:"status,omitempty"`
}