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>
57 lines
1.2 KiB
Go
57 lines
1.2 KiB
Go
package analyzer
|
|
|
|
import "git.mchus.pro/mchus/logpile/internal/models"
|
|
|
|
// Analyzer processes parsed IPMI data
|
|
type Analyzer struct {
|
|
result *models.AnalysisResult
|
|
}
|
|
|
|
// New creates a new analyzer
|
|
func New() *Analyzer {
|
|
return &Analyzer{}
|
|
}
|
|
|
|
// SetData sets the data to analyze
|
|
func (a *Analyzer) SetData(result *models.AnalysisResult) {
|
|
a.result = result
|
|
}
|
|
|
|
// GetCriticalEvents returns only critical severity events
|
|
func (a *Analyzer) GetCriticalEvents() []models.Event {
|
|
if a.result == nil {
|
|
return nil
|
|
}
|
|
|
|
var critical []models.Event
|
|
for _, e := range a.result.Events {
|
|
if e.Severity == models.SeverityCritical {
|
|
critical = append(critical, e)
|
|
}
|
|
}
|
|
return critical
|
|
}
|
|
|
|
// GetEventsBySensorType returns events filtered by sensor type
|
|
func (a *Analyzer) GetEventsBySensorType(sensorType string) []models.Event {
|
|
if a.result == nil {
|
|
return nil
|
|
}
|
|
|
|
var filtered []models.Event
|
|
for _, e := range a.result.Events {
|
|
if e.SensorType == sensorType {
|
|
filtered = append(filtered, e)
|
|
}
|
|
}
|
|
return filtered
|
|
}
|
|
|
|
// GetAllSerials returns all serial numbers from FRU data
|
|
func (a *Analyzer) GetAllSerials() []models.FRUInfo {
|
|
if a.result == nil {
|
|
return nil
|
|
}
|
|
return a.result.FRU
|
|
}
|