diff --git a/AppImage/components/storage-overview.tsx b/AppImage/components/storage-overview.tsx index fd107a2f..d934ca6f 100644 --- a/AppImage/components/storage-overview.tsx +++ b/AppImage/components/storage-overview.tsx @@ -1470,6 +1470,353 @@ export function StorageOverview() { ) } +// Generate SMART Report HTML and open in new window (same pattern as Lynis/Latency reports) +function openSmartReport(disk: DiskInfo, testStatus: SmartTestStatus, smartAttributes: Array<{id: number; name: string; value: number; worst: number; threshold: number; raw_value: string; status: 'ok' | 'warning' | 'critical'}>) { + const now = new Date().toLocaleString() + const logoUrl = `${window.location.origin}/images/proxmenux-logo.png` + const reportId = `SMART-${Date.now().toString(36).toUpperCase()}` + + // Determine disk type + let diskType = "HDD" + if (disk.name.startsWith("nvme")) { + diskType = "NVMe" + } else if (!disk.rotation_rate || disk.rotation_rate === 0) { + diskType = "SSD" + } + + // Health status styling + const healthStatus = testStatus.smart_status || (testStatus.smart_data?.smart_status) || 'unknown' + const isHealthy = healthStatus.toLowerCase() === 'passed' + const healthColor = isHealthy ? '#16a34a' : healthStatus.toLowerCase() === 'failed' ? '#dc2626' : '#ca8a04' + const healthLabel = isHealthy ? 'PASSED' : healthStatus.toUpperCase() + + // Format power on time + const powerOnHours = disk.power_on_hours || testStatus.smart_data?.power_on_hours || 0 + const powerOnDays = Math.round(powerOnHours / 24) + const powerOnYears = Math.floor(powerOnHours / 8760) + const powerOnRemainingDays = Math.floor((powerOnHours % 8760) / 24) + const powerOnFormatted = powerOnYears > 0 + ? `${powerOnYears}y ${powerOnRemainingDays}d (${powerOnHours.toLocaleString()}h)` + : `${powerOnDays}d (${powerOnHours.toLocaleString()}h)` + + // Build attributes table + const attributeRows = smartAttributes.map((attr, i) => { + const statusColor = attr.status === 'ok' ? '#16a34a' : attr.status === 'warning' ? '#ca8a04' : '#dc2626' + const statusBg = attr.status === 'ok' ? '#16a34a15' : attr.status === 'warning' ? '#ca8a0415' : '#dc262615' + return ` +
All SMART attributes are within normal ranges. Continue regular monitoring.
SMART has reported a health issue. Backup all data immediately and plan for disk replacement.
The disk has bad sectors that have been remapped. Monitor closely and consider replacement if count increases.
There are sectors waiting to be reallocated. This may indicate impending failure.
HDD is running hot. Improve case airflow or add cooling.
SSD is running hot. Check airflow around the drive.
NVMe is overheating. Consider adding a heatsink or improving case airflow.
Schedule periodic extended SMART tests (monthly) to catch issues early.
Ensure critical data is backed up regularly regardless of disk health status.
ProxMenux Monitor - Disk Health Analysis
++ ${isHealthy + ? `This disk is operating within normal parameters. All SMART attributes are within acceptable thresholds. The disk has been powered on for approximately ${powerOnFormatted} and is currently operating at ${disk.temperature > 0 ? disk.temperature + '°C' : 'N/A'}. ${(disk.reallocated_sectors ?? 0) === 0 ? 'No bad sectors have been detected.' : `${disk.reallocated_sectors} reallocated sector(s) detected - monitor closely.`}` + : `This disk has reported a SMART health failure. Immediate action is required. Backup all critical data and plan for disk replacement.` + } +
+| ID | +Attribute | +Value | +Worst | +Thresh | +Raw Value | +Status | +
|---|---|---|---|---|---|---|
| No SMART attributes available | ||||||