script
This commit is contained in:
@@ -30,6 +30,7 @@ class Benchmark(Base):
|
||||
|
||||
# Details
|
||||
details_json = Column(Text, nullable=False) # JSON object with all raw results
|
||||
network_results_json = Column(Text, nullable=True) # Network benchmark details (iperf3)
|
||||
notes = Column(Text, nullable=True)
|
||||
|
||||
# Relationships
|
||||
|
||||
48
backend/app/models/disk_smart.py
Normal file
48
backend/app/models/disk_smart.py
Normal file
@@ -0,0 +1,48 @@
|
||||
"""
|
||||
Linux BenchTools - Disk SMART Data Model
|
||||
"""
|
||||
|
||||
from sqlalchemy import Column, Integer, String, Float, DateTime, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from datetime import datetime
|
||||
from app.db.base import Base
|
||||
|
||||
|
||||
class DiskSMART(Base):
|
||||
"""
|
||||
SMART health and aging data for storage devices
|
||||
"""
|
||||
__tablename__ = "disk_smart_data"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
|
||||
hardware_snapshot_id = Column(Integer, ForeignKey("hardware_snapshots.id"), nullable=False, index=True)
|
||||
captured_at = Column(DateTime, nullable=False, default=datetime.utcnow)
|
||||
|
||||
# Disk identification
|
||||
device_name = Column(String(50), nullable=False) # e.g., "sda", "nvme0n1"
|
||||
model = Column(String(255), nullable=True)
|
||||
serial_number = Column(String(100), nullable=True)
|
||||
size_gb = Column(Float, nullable=True)
|
||||
disk_type = Column(String(20), nullable=True) # "ssd" or "hdd"
|
||||
interface = Column(String(50), nullable=True) # "sata", "nvme", "usb"
|
||||
|
||||
# SMART Health Status
|
||||
health_status = Column(String(20), nullable=True) # "PASSED", "FAILED", or null
|
||||
temperature_celsius = Column(Integer, nullable=True)
|
||||
|
||||
# Aging indicators
|
||||
power_on_hours = Column(Integer, nullable=True)
|
||||
power_cycle_count = Column(Integer, nullable=True)
|
||||
reallocated_sectors = Column(Integer, nullable=True) # Critical: bad sectors
|
||||
pending_sectors = Column(Integer, nullable=True) # Very critical: imminent failure
|
||||
udma_crc_errors = Column(Integer, nullable=True) # Cable/interface issues
|
||||
|
||||
# SSD-specific
|
||||
wear_leveling_count = Column(Integer, nullable=True) # 0-100 (higher is better)
|
||||
total_lbas_written = Column(Float, nullable=True) # Total data written
|
||||
|
||||
# Relationship
|
||||
hardware_snapshot = relationship("HardwareSnapshot", back_populates="disk_smart_data")
|
||||
|
||||
def __repr__(self):
|
||||
return f"<DiskSMART(id={self.id}, device='{self.device_name}', health='{self.health_status}')>"
|
||||
@@ -34,6 +34,9 @@ class HardwareSnapshot(Base):
|
||||
|
||||
# RAM
|
||||
ram_total_mb = Column(Integer, nullable=True)
|
||||
ram_used_mb = Column(Integer, nullable=True) # NEW: RAM utilisée
|
||||
ram_free_mb = Column(Integer, nullable=True) # NEW: RAM libre
|
||||
ram_shared_mb = Column(Integer, nullable=True) # NEW: RAM partagée (tmpfs/vidéo)
|
||||
ram_slots_total = Column(Integer, nullable=True)
|
||||
ram_slots_used = Column(Integer, nullable=True)
|
||||
ram_ecc = Column(Boolean, nullable=True)
|
||||
@@ -74,6 +77,7 @@ class HardwareSnapshot(Base):
|
||||
# Relationships
|
||||
device = relationship("Device", back_populates="hardware_snapshots")
|
||||
benchmarks = relationship("Benchmark", back_populates="hardware_snapshot")
|
||||
disk_smart_data = relationship("DiskSMART", back_populates="hardware_snapshot", cascade="all, delete-orphan")
|
||||
|
||||
def __repr__(self):
|
||||
return f"<HardwareSnapshot(id={self.id}, device_id={self.device_id}, captured_at='{self.captured_at}')>"
|
||||
|
||||
Reference in New Issue
Block a user