255 lines
16 KiB
Go
255 lines
16 KiB
Go
package exporter
|
|
|
|
// ReanimatorExport represents the top-level structure for Reanimator format export
|
|
type ReanimatorExport struct {
|
|
Filename string `json:"filename"`
|
|
SourceType string `json:"source_type,omitempty"`
|
|
Protocol string `json:"protocol,omitempty"`
|
|
TargetHost string `json:"target_host,omitempty"`
|
|
CollectedAt string `json:"collected_at"` // RFC3339 format
|
|
Hardware ReanimatorHardware `json:"hardware"`
|
|
}
|
|
|
|
// ReanimatorHardware contains all hardware components
|
|
type ReanimatorHardware struct {
|
|
Board ReanimatorBoard `json:"board"`
|
|
Firmware []ReanimatorFirmware `json:"firmware,omitempty"`
|
|
CPUs []ReanimatorCPU `json:"cpus,omitempty"`
|
|
Memory []ReanimatorMemory `json:"memory,omitempty"`
|
|
Storage []ReanimatorStorage `json:"storage,omitempty"`
|
|
PCIeDevices []ReanimatorPCIe `json:"pcie_devices,omitempty"`
|
|
PowerSupplies []ReanimatorPSU `json:"power_supplies,omitempty"`
|
|
Sensors *ReanimatorSensors `json:"sensors,omitempty"`
|
|
EventLogs []ReanimatorEventLog `json:"event_logs,omitempty"`
|
|
}
|
|
|
|
// ReanimatorBoard represents motherboard/server information
|
|
type ReanimatorBoard struct {
|
|
Manufacturer string `json:"manufacturer,omitempty"`
|
|
ProductName string `json:"product_name,omitempty"`
|
|
SerialNumber string `json:"serial_number"`
|
|
PartNumber string `json:"part_number,omitempty"`
|
|
UUID string `json:"uuid,omitempty"`
|
|
}
|
|
|
|
// ReanimatorFirmware represents firmware version information
|
|
type ReanimatorFirmware struct {
|
|
DeviceName string `json:"device_name"`
|
|
Version string `json:"version"`
|
|
}
|
|
|
|
type ReanimatorStatusHistoryEntry struct {
|
|
Status string `json:"status"`
|
|
ChangedAt string `json:"changed_at"`
|
|
Details string `json:"details,omitempty"`
|
|
}
|
|
|
|
// ReanimatorCPU represents processor information
|
|
type ReanimatorCPU struct {
|
|
Socket int `json:"socket"`
|
|
Model string `json:"model,omitempty"`
|
|
Cores int `json:"cores,omitempty"`
|
|
Threads int `json:"threads,omitempty"`
|
|
FrequencyMHz int `json:"frequency_mhz,omitempty"`
|
|
MaxFrequencyMHz int `json:"max_frequency_mhz,omitempty"`
|
|
TemperatureC float64 `json:"temperature_c,omitempty"`
|
|
PowerW float64 `json:"power_w,omitempty"`
|
|
Throttled *bool `json:"throttled,omitempty"`
|
|
CorrectableErrorCount int64 `json:"correctable_error_count,omitempty"`
|
|
UncorrectableErrorCount int64 `json:"uncorrectable_error_count,omitempty"`
|
|
LifeRemainingPct float64 `json:"life_remaining_pct,omitempty"`
|
|
LifeUsedPct float64 `json:"life_used_pct,omitempty"`
|
|
SerialNumber string `json:"serial_number,omitempty"`
|
|
Firmware string `json:"firmware,omitempty"`
|
|
Present *bool `json:"present,omitempty"`
|
|
Manufacturer string `json:"manufacturer,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
StatusCheckedAt string `json:"status_checked_at,omitempty"`
|
|
StatusChangedAt string `json:"status_changed_at,omitempty"`
|
|
ManufacturedYearWeek string `json:"manufactured_year_week,omitempty"`
|
|
StatusHistory []ReanimatorStatusHistoryEntry `json:"status_history,omitempty"`
|
|
ErrorDescription string `json:"error_description,omitempty"`
|
|
}
|
|
|
|
// ReanimatorMemory represents a memory module (DIMM)
|
|
type ReanimatorMemory struct {
|
|
Slot string `json:"slot"`
|
|
Location string `json:"location,omitempty"`
|
|
Present *bool `json:"present,omitempty"`
|
|
SizeMB int `json:"size_mb,omitempty"`
|
|
Type string `json:"type,omitempty"`
|
|
MaxSpeedMHz int `json:"max_speed_mhz,omitempty"`
|
|
CurrentSpeedMHz int `json:"current_speed_mhz,omitempty"`
|
|
TemperatureC float64 `json:"temperature_c,omitempty"`
|
|
CorrectableECCErrorCount int64 `json:"correctable_ecc_error_count,omitempty"`
|
|
UncorrectableECCErrorCount int64 `json:"uncorrectable_ecc_error_count,omitempty"`
|
|
LifeRemainingPct float64 `json:"life_remaining_pct,omitempty"`
|
|
LifeUsedPct float64 `json:"life_used_pct,omitempty"`
|
|
SpareBlocksRemainingPct float64 `json:"spare_blocks_remaining_pct,omitempty"`
|
|
PerformanceDegraded *bool `json:"performance_degraded,omitempty"`
|
|
DataLossDetected *bool `json:"data_loss_detected,omitempty"`
|
|
Manufacturer string `json:"manufacturer,omitempty"`
|
|
SerialNumber string `json:"serial_number,omitempty"`
|
|
PartNumber string `json:"part_number,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
StatusCheckedAt string `json:"status_checked_at,omitempty"`
|
|
StatusChangedAt string `json:"status_changed_at,omitempty"`
|
|
ManufacturedYearWeek string `json:"manufactured_year_week,omitempty"`
|
|
StatusHistory []ReanimatorStatusHistoryEntry `json:"status_history,omitempty"`
|
|
ErrorDescription string `json:"error_description,omitempty"`
|
|
}
|
|
|
|
// ReanimatorStorage represents a storage device
|
|
type ReanimatorStorage struct {
|
|
Slot string `json:"slot"`
|
|
Type string `json:"type,omitempty"`
|
|
Model string `json:"model"`
|
|
SizeGB int `json:"size_gb,omitempty"`
|
|
SerialNumber string `json:"serial_number"`
|
|
Manufacturer string `json:"manufacturer,omitempty"`
|
|
Firmware string `json:"firmware,omitempty"`
|
|
Interface string `json:"interface,omitempty"`
|
|
Present *bool `json:"present,omitempty"`
|
|
TemperatureC float64 `json:"temperature_c,omitempty"`
|
|
PowerOnHours int64 `json:"power_on_hours,omitempty"`
|
|
PowerCycles int64 `json:"power_cycles,omitempty"`
|
|
UnsafeShutdowns int64 `json:"unsafe_shutdowns,omitempty"`
|
|
MediaErrors int64 `json:"media_errors,omitempty"`
|
|
ErrorLogEntries int64 `json:"error_log_entries,omitempty"`
|
|
WrittenBytes int64 `json:"written_bytes,omitempty"`
|
|
ReadBytes int64 `json:"read_bytes,omitempty"`
|
|
LifeUsedPct float64 `json:"life_used_pct,omitempty"`
|
|
RemainingEndurancePct *int `json:"remaining_endurance_pct,omitempty"`
|
|
LifeRemainingPct float64 `json:"life_remaining_pct,omitempty"`
|
|
AvailableSparePct float64 `json:"available_spare_pct,omitempty"`
|
|
ReallocatedSectors int64 `json:"reallocated_sectors,omitempty"`
|
|
CurrentPendingSectors int64 `json:"current_pending_sectors,omitempty"`
|
|
OfflineUncorrectable int64 `json:"offline_uncorrectable,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
StatusCheckedAt string `json:"status_checked_at,omitempty"`
|
|
StatusChangedAt string `json:"status_changed_at,omitempty"`
|
|
ManufacturedYearWeek string `json:"manufactured_year_week,omitempty"`
|
|
StatusHistory []ReanimatorStatusHistoryEntry `json:"status_history,omitempty"`
|
|
ErrorDescription string `json:"error_description,omitempty"`
|
|
}
|
|
|
|
// ReanimatorPCIe represents a PCIe device
|
|
type ReanimatorPCIe struct {
|
|
Slot string `json:"slot"`
|
|
VendorID int `json:"vendor_id,omitempty"`
|
|
DeviceID int `json:"device_id,omitempty"`
|
|
NUMANode int `json:"numa_node,omitempty"`
|
|
TemperatureC float64 `json:"temperature_c,omitempty"`
|
|
PowerW float64 `json:"power_w,omitempty"`
|
|
LifeRemainingPct float64 `json:"life_remaining_pct,omitempty"`
|
|
LifeUsedPct float64 `json:"life_used_pct,omitempty"`
|
|
ECCCorrectedTotal int64 `json:"ecc_corrected_total,omitempty"`
|
|
ECCUncorrectedTotal int64 `json:"ecc_uncorrected_total,omitempty"`
|
|
HWSlowdown *bool `json:"hw_slowdown,omitempty"`
|
|
BatteryChargePct float64 `json:"battery_charge_pct,omitempty"`
|
|
BatteryHealthPct float64 `json:"battery_health_pct,omitempty"`
|
|
BatteryTemperatureC float64 `json:"battery_temperature_c,omitempty"`
|
|
BatteryVoltageV float64 `json:"battery_voltage_v,omitempty"`
|
|
BatteryReplaceRequired *bool `json:"battery_replace_required,omitempty"`
|
|
SFPTemperatureC float64 `json:"sfp_temperature_c,omitempty"`
|
|
SFPTXPowerDBm float64 `json:"sfp_tx_power_dbm,omitempty"`
|
|
SFPRXPowerDBm float64 `json:"sfp_rx_power_dbm,omitempty"`
|
|
SFPVoltageV float64 `json:"sfp_voltage_v,omitempty"`
|
|
SFPBiasMA float64 `json:"sfp_bias_ma,omitempty"`
|
|
BDF string `json:"-"`
|
|
DeviceClass string `json:"device_class,omitempty"`
|
|
Manufacturer string `json:"manufacturer,omitempty"`
|
|
Model string `json:"model,omitempty"`
|
|
LinkWidth int `json:"link_width,omitempty"`
|
|
LinkSpeed string `json:"link_speed,omitempty"`
|
|
MaxLinkWidth int `json:"max_link_width,omitempty"`
|
|
MaxLinkSpeed string `json:"max_link_speed,omitempty"`
|
|
MACAddresses []string `json:"mac_addresses,omitempty"`
|
|
Present *bool `json:"present,omitempty"`
|
|
SerialNumber string `json:"serial_number,omitempty"`
|
|
Firmware string `json:"firmware,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
StatusCheckedAt string `json:"status_checked_at,omitempty"`
|
|
StatusChangedAt string `json:"status_changed_at,omitempty"`
|
|
ManufacturedYearWeek string `json:"manufactured_year_week,omitempty"`
|
|
StatusHistory []ReanimatorStatusHistoryEntry `json:"status_history,omitempty"`
|
|
ErrorDescription string `json:"error_description,omitempty"`
|
|
}
|
|
|
|
// ReanimatorPSU represents a power supply unit
|
|
type ReanimatorPSU struct {
|
|
Slot string `json:"slot"`
|
|
Present *bool `json:"present,omitempty"`
|
|
Model string `json:"model,omitempty"`
|
|
Vendor string `json:"vendor,omitempty"`
|
|
WattageW int `json:"wattage_w,omitempty"`
|
|
SerialNumber string `json:"serial_number,omitempty"`
|
|
PartNumber string `json:"part_number,omitempty"`
|
|
Firmware string `json:"firmware,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
InputType string `json:"input_type,omitempty"`
|
|
InputPowerW float64 `json:"input_power_w,omitempty"`
|
|
OutputPowerW float64 `json:"output_power_w,omitempty"`
|
|
InputVoltage float64 `json:"input_voltage,omitempty"`
|
|
TemperatureC float64 `json:"temperature_c,omitempty"`
|
|
LifeRemainingPct float64 `json:"life_remaining_pct,omitempty"`
|
|
LifeUsedPct float64 `json:"life_used_pct,omitempty"`
|
|
StatusCheckedAt string `json:"status_checked_at,omitempty"`
|
|
StatusChangedAt string `json:"status_changed_at,omitempty"`
|
|
ManufacturedYearWeek string `json:"manufactured_year_week,omitempty"`
|
|
StatusHistory []ReanimatorStatusHistoryEntry `json:"status_history,omitempty"`
|
|
ErrorDescription string `json:"error_description,omitempty"`
|
|
}
|
|
|
|
type ReanimatorEventLog struct {
|
|
Source string `json:"source"`
|
|
EventTime string `json:"event_time,omitempty"`
|
|
Severity string `json:"severity,omitempty"`
|
|
MessageID string `json:"message_id,omitempty"`
|
|
Message string `json:"message"`
|
|
ComponentRef string `json:"component_ref,omitempty"`
|
|
Fingerprint string `json:"fingerprint,omitempty"`
|
|
IsActive *bool `json:"is_active,omitempty"`
|
|
RawPayload map[string]any `json:"raw_payload,omitempty"`
|
|
}
|
|
|
|
type ReanimatorSensors struct {
|
|
Fans []ReanimatorFanSensor `json:"fans,omitempty"`
|
|
Power []ReanimatorPowerSensor `json:"power,omitempty"`
|
|
Temperatures []ReanimatorTemperatureSensor `json:"temperatures,omitempty"`
|
|
Other []ReanimatorOtherSensor `json:"other,omitempty"`
|
|
}
|
|
|
|
type ReanimatorFanSensor struct {
|
|
Name string `json:"name"`
|
|
Location string `json:"location,omitempty"`
|
|
RPM int `json:"rpm,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
}
|
|
|
|
type ReanimatorPowerSensor struct {
|
|
Name string `json:"name"`
|
|
Location string `json:"location,omitempty"`
|
|
VoltageV float64 `json:"voltage_v,omitempty"`
|
|
CurrentA float64 `json:"current_a,omitempty"`
|
|
PowerW float64 `json:"power_w,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
}
|
|
|
|
type ReanimatorTemperatureSensor struct {
|
|
Name string `json:"name"`
|
|
Location string `json:"location,omitempty"`
|
|
Celsius float64 `json:"celsius,omitempty"`
|
|
ThresholdWarningCelsius float64 `json:"threshold_warning_celsius,omitempty"`
|
|
ThresholdCriticalCelsius float64 `json:"threshold_critical_celsius,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
}
|
|
|
|
type ReanimatorOtherSensor struct {
|
|
Name string `json:"name"`
|
|
Location string `json:"location,omitempty"`
|
|
Value float64 `json:"value,omitempty"`
|
|
Unit string `json:"unit,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
}
|