290 lines
14 KiB
Go
290 lines
14 KiB
Go
// Package schema defines the HardwareIngestRequest types compatible with
|
|
// core/internal/ingest/parser_hardware.go. No import dependency on core.
|
|
package schema
|
|
|
|
// HardwareIngestRequest is the top-level output document produced by `bee audit`.
|
|
// It is accepted as-is by the core /api/ingest/hardware endpoint.
|
|
type HardwareIngestRequest struct {
|
|
Filename *string `json:"filename,omitempty"`
|
|
SourceType *string `json:"source_type,omitempty"`
|
|
Protocol *string `json:"protocol,omitempty"`
|
|
TargetHost *string `json:"target_host,omitempty"`
|
|
CollectedAt string `json:"collected_at"`
|
|
Runtime *RuntimeHealth `json:"runtime,omitempty"`
|
|
Hardware HardwareSnapshot `json:"hardware"`
|
|
}
|
|
|
|
type RuntimeHealth struct {
|
|
Status string `json:"status"`
|
|
CheckedAt string `json:"checked_at"`
|
|
ExportDir string `json:"export_dir,omitempty"`
|
|
DriverReady bool `json:"driver_ready,omitempty"`
|
|
CUDAReady bool `json:"cuda_ready,omitempty"`
|
|
NetworkStatus string `json:"network_status,omitempty"`
|
|
Issues []RuntimeIssue `json:"issues,omitempty"`
|
|
Tools []RuntimeToolStatus `json:"tools,omitempty"`
|
|
Services []RuntimeServiceStatus `json:"services,omitempty"`
|
|
Interfaces []RuntimeInterface `json:"interfaces,omitempty"`
|
|
}
|
|
|
|
type RuntimeIssue struct {
|
|
Code string `json:"code"`
|
|
Severity string `json:"severity,omitempty"`
|
|
Description string `json:"description"`
|
|
}
|
|
|
|
type RuntimeToolStatus struct {
|
|
Name string `json:"name"`
|
|
Path string `json:"path,omitempty"`
|
|
OK bool `json:"ok"`
|
|
}
|
|
|
|
type RuntimeServiceStatus struct {
|
|
Name string `json:"name"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
type RuntimeInterface struct {
|
|
Name string `json:"name"`
|
|
State string `json:"state,omitempty"`
|
|
IPv4 []string `json:"ipv4,omitempty"`
|
|
Outcome string `json:"outcome,omitempty"`
|
|
}
|
|
|
|
type HardwareSnapshot struct {
|
|
Board HardwareBoard `json:"board"`
|
|
Firmware []HardwareFirmwareRecord `json:"firmware,omitempty"`
|
|
CPUs []HardwareCPU `json:"cpus,omitempty"`
|
|
Memory []HardwareMemory `json:"memory,omitempty"`
|
|
Storage []HardwareStorage `json:"storage,omitempty"`
|
|
PCIeDevices []HardwarePCIeDevice `json:"pcie_devices,omitempty"`
|
|
PowerSupplies []HardwarePowerSupply `json:"power_supplies,omitempty"`
|
|
Sensors *HardwareSensors `json:"sensors,omitempty"`
|
|
EventLogs []HardwareEventLog `json:"event_logs,omitempty"`
|
|
}
|
|
|
|
type HardwareHealthSummary struct {
|
|
Status string `json:"status"`
|
|
Warnings []string `json:"warnings,omitempty"`
|
|
Failures []string `json:"failures,omitempty"`
|
|
StorageWarn int `json:"storage_warn,omitempty"`
|
|
StorageFail int `json:"storage_fail,omitempty"`
|
|
PCIeWarn int `json:"pcie_warn,omitempty"`
|
|
PCIeFail int `json:"pcie_fail,omitempty"`
|
|
PSUWarn int `json:"psu_warn,omitempty"`
|
|
PSUFail int `json:"psu_fail,omitempty"`
|
|
MemoryWarn int `json:"memory_warn,omitempty"`
|
|
MemoryFail int `json:"memory_fail,omitempty"`
|
|
EmptyDIMMs int `json:"empty_dimms,omitempty"`
|
|
MissingPSUs int `json:"missing_psus,omitempty"`
|
|
CollectedAt string `json:"collected_at,omitempty"`
|
|
}
|
|
|
|
type HardwareBoard 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"`
|
|
}
|
|
|
|
type HardwareFirmwareRecord struct {
|
|
DeviceName string `json:"device_name"`
|
|
Version string `json:"version"`
|
|
}
|
|
|
|
type HardwareCPU struct {
|
|
HardwareComponentStatus
|
|
Socket *int `json:"socket,omitempty"`
|
|
Model *string `json:"model,omitempty"`
|
|
Manufacturer *string `json:"manufacturer,omitempty"`
|
|
SerialNumber *string `json:"serial_number,omitempty"`
|
|
Firmware *string `json:"firmware,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"`
|
|
Present *bool `json:"present,omitempty"`
|
|
}
|
|
|
|
type HardwareMemory struct {
|
|
HardwareComponentStatus
|
|
Slot *string `json:"slot,omitempty"`
|
|
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"`
|
|
Manufacturer *string `json:"manufacturer,omitempty"`
|
|
SerialNumber *string `json:"serial_number,omitempty"`
|
|
PartNumber *string `json:"part_number,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"`
|
|
}
|
|
|
|
type HardwareStorage struct {
|
|
HardwareComponentStatus
|
|
Slot *string `json:"slot,omitempty"`
|
|
Type *string `json:"type,omitempty"`
|
|
Model *string `json:"model,omitempty"`
|
|
SizeGB *int `json:"size_gb,omitempty"`
|
|
SerialNumber *string `json:"serial_number,omitempty"`
|
|
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"`
|
|
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"`
|
|
Telemetry map[string]any `json:"-"`
|
|
}
|
|
|
|
type HardwarePCIeDevice struct {
|
|
HardwareComponentStatus
|
|
Slot *string `json:"slot,omitempty"`
|
|
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"`
|
|
SerialNumber *string `json:"serial_number,omitempty"`
|
|
Firmware *string `json:"firmware,omitempty"`
|
|
MacAddresses []string `json:"mac_addresses,omitempty"`
|
|
Present *bool `json:"present,omitempty"`
|
|
Telemetry map[string]any `json:"-"`
|
|
}
|
|
|
|
type HardwarePowerSupply struct {
|
|
HardwareComponentStatus
|
|
Slot *string `json:"slot,omitempty"`
|
|
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"`
|
|
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"`
|
|
}
|
|
|
|
type HardwareComponentStatus struct {
|
|
Status *string `json:"status,omitempty"`
|
|
StatusCheckedAt *string `json:"status_checked_at,omitempty"`
|
|
StatusChangedAt *string `json:"status_changed_at,omitempty"`
|
|
StatusHistory []HardwareStatusHistory `json:"status_history,omitempty"`
|
|
ErrorDescription *string `json:"error_description,omitempty"`
|
|
ManufacturedYearWeek *string `json:"manufactured_year_week,omitempty"`
|
|
}
|
|
|
|
type HardwareStatusHistory struct {
|
|
Status string `json:"status"`
|
|
ChangedAt string `json:"changed_at"`
|
|
Details *string `json:"details,omitempty"`
|
|
}
|
|
|
|
type HardwareSensors struct {
|
|
Fans []HardwareFanSensor `json:"fans,omitempty"`
|
|
Power []HardwarePowerSensor `json:"power,omitempty"`
|
|
Temperatures []HardwareTemperatureSensor `json:"temperatures,omitempty"`
|
|
Other []HardwareOtherSensor `json:"other,omitempty"`
|
|
}
|
|
|
|
type HardwareFanSensor struct {
|
|
Name string `json:"name"`
|
|
Location *string `json:"location,omitempty"`
|
|
RPM *int `json:"rpm,omitempty"`
|
|
Status *string `json:"status,omitempty"`
|
|
}
|
|
|
|
type HardwarePowerSensor 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 HardwareTemperatureSensor 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 HardwareOtherSensor 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"`
|
|
}
|
|
|
|
type HardwareEventLog 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"`
|
|
}
|