Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix: Pass SMART disk temperatures to frontend. Related to #941

rcourtmand377a5c4645a
diff --git a/frontend-modern/src/components/Hosts/HostsOverview.tsx b/frontend-modern/src/components/Hosts/HostsOverview.tsx
index ac274f81e2..b7369e10ae 100644
--- a/frontend-modern/src/components/Hosts/HostsOverview.tsx
+++ b/frontend-modern/src/components/Hosts/HostsOverview.tsx
@@ -152,10 +152,19 @@ function HostNetworkInfoCell(props: { networkInterfaces: NetworkInterface[] }) {
}
// Temperature cell with rich tooltip showing all sensor readings
+interface HostDiskSMARTForCell {
+ device: string;
+ model?: string;
+ temperature: number;
+ health?: string;
+ standby?: boolean;
+}
+
interface HostSensorSummaryForCell {
temperatureCelsius?: Record<string, number>;
fanRpm?: Record<string, number>;
additional?: Record<string, number>;
+ smart?: HostDiskSMARTForCell[];
}
function HostTemperatureCell(props: { sensors: HostSensorSummaryForCell | null | undefined }) {
@@ -164,27 +173,42 @@ function HostTemperatureCell(props: { sensors: HostSensorSummaryForCell | null |
// Get the primary (highest) temperature for display
const primaryTemp = createMemo(() => {
- if (!props.sensors?.temperatureCelsius) return null;
- const temps = Object.values(props.sensors.temperatureCelsius);
- if (temps.length === 0) return null;
- // Find package/composite temp first, otherwise show max
- const keys = Object.keys(props.sensors.temperatureCelsius);
- const packageKey = keys.find(k =>
- k.toLowerCase().includes('package') ||
- k.toLowerCase().includes('composite') ||
- k.toLowerCase().includes('tctl')
- );
- if (packageKey) return props.sensors.temperatureCelsius[packageKey];
- return Math.max(...temps);
+ // First try CPU/sensor temperatures
+ if (props.sensors?.temperatureCelsius) {
+ const temps = Object.values(props.sensors.temperatureCelsius);
+ if (temps.length > 0) {
+ // Find package/composite temp first, otherwise show max
+ const keys = Object.keys(props.sensors.temperatureCelsius);
+ const packageKey = keys.find(k =>
+ k.toLowerCase().includes('package') ||
+ k.toLowerCase().includes('composite') ||
+ k.toLowerCase().includes('tctl')
+ );
+ if (packageKey) return props.sensors.temperatureCelsius[packageKey];
+ return Math.max(...temps);
+ }
+ }
+ // Fall back to max SMART disk temperature if no sensor temps
+ if (props.sensors?.smart && props.sensors.smart.length > 0) {
+ const diskTemps = props.sensors.smart
+ .filter(d => !d.standby && d.temperature > 0)
+ .map(d => d.temperature);
+ if (diskTemps.length > 0) {
+ return Math.max(...diskTemps);
+ }
+ }
+ return null;
});
const hasSensors = () => {
const temps = props.sensors?.temperatureCelsius;
const fans = props.sensors?.fanRpm;
const additional = props.sensors?.additional;
+ const smart = props.sensors?.smart;
return (temps && Object.keys(temps).length > 0) ||
(fans && Object.keys(fans).length > 0) ||
- (additional && Object.keys(additional).length > 0);
+ (additional && Object.keys(additional).length > 0) ||
+ (smart && smart.length > 0);
};
// Color based on temperature
@@ -237,6 +261,12 @@ function HostTemperatureCell(props: { sensors: HostSensorSummaryForCell | null |
return Object.entries(props.sensors.additional).sort(([a], [b]) => a.localeCompare(b));
});
+ // Sort SMART disks by device name
+ const sortedSmart = createMemo(() => {
+ if (!props.sensors?.smart) return [];
+ return [...props.sensors.smart].sort((a, b) => a.device.localeCompare(b.device));
+ });
+
// Format sensor name for display (e.g., "nct6687_cpu_fan" -> "CPU Fan")
const formatSensorName = (name: string) => {
// Remove chip prefix (e.g., "nct6687_" or "coretemp_")
@@ -290,6 +320,40 @@ function HostTemperatureCell(props: { sensors: HostSensorSummaryForCell | null |
</div>
</Show>
+ {/* Disk temperatures section (SMART) */}
+ <Show when={sortedSmart().length > 0}>
+ <div class="font-medium mb-1 text-gray-300 border-b border-gray-700 pb-1">
+ Disk Temperatures
+ </div>
+ <div class="space-y-0.5 mb-2">
+ <For each={sortedSmart()}>
+ {(disk) => {
+ if (disk.standby) {
+ return (
+ <div class="flex justify-between gap-3 py-0.5">
+ <span class="text-gray-400 truncate max-w-[140px]" title={disk.model}>
+ {disk.device}
+ </span>
+ <span class="font-medium font-mono text-gray-500">standby</span>
+ </div>
+ );
+ }
+ const temp = disk.temperature;
+ // For HDDs, 45°C is warm, 50°C+ is hot; for SSDs use higher thresholds
+ const colorClass = temp >= 55 ? 'text-red-400' : temp >= 45 ? 'text-yellow-400' : 'text-gray-200';
+ return (
+ <div class="flex justify-between gap-3 py-0.5">
+ <span class="text-gray-400 truncate max-w-[140px]" title={disk.model}>
+ {disk.device}
+ </span>
+ <span class={`font-medium font-mono ${colorClass}`}>{temp}°C</span>
+ </div>
+ );
+ }}
+ </For>
+ </div>
+ </Show>
+
{/* Fan speeds section */}
<Show when={sortedFans().length > 0}>
<div class="font-medium mb-1 text-gray-300 border-b border-gray-700 pb-1">
diff --git a/frontend-modern/src/types/api.ts b/frontend-modern/src/types/api.ts
index cd8a00bb41..77dc021e65 100644
--- a/frontend-modern/src/types/api.ts
+++ b/frontend-modern/src/types/api.ts
@@ -477,6 +477,18 @@ export interface HostSensorSummary {
temperatureCelsius?: Record<string, number>;
fanRpm?: Record<string, number>;
additional?: Record<string, number>;
+ smart?: HostDiskSMART[]; // S.M.A.R.T. disk data
+}
+
+export interface HostDiskSMART {
+ device: string; // Device name (e.g., sda)
+ model?: string; // Disk model
+ serial?: string; // Serial number
+ wwn?: string; // World Wide Name
+ type?: string; // Transport type: sata, sas, nvme
+ temperature: number; // Temperature in Celsius
+ health?: string; // PASSED, FAILED, UNKNOWN
+ standby?: boolean; // True if disk was in standby
}
export interface HostRAIDArray {
diff --git a/internal/models/converters.go b/internal/models/converters.go
index 90d82cd587..af4d90bcc0 100644
--- a/internal/models/converters.go
+++ b/internal/models/converters.go
@@ -719,7 +719,7 @@ func (s DockerSwarmInfo) ToFrontend() DockerSwarmFrontend {
}
func hostSensorSummaryToFrontend(src HostSensorSummary) *HostSensorSummaryFrontend {
- if len(src.TemperatureCelsius) == 0 && len(src.FanRPM) == 0 && len(src.Additional) == 0 {
+ if len(src.TemperatureCelsius) == 0 && len(src.FanRPM) == 0 && len(src.Additional) == 0 && len(src.SMART) == 0 {
return nil
}
@@ -733,6 +733,21 @@ func hostSensorSummaryToFrontend(src HostSensorSummary) *HostSensorSummaryFronte
if len(src.Additional) > 0 {
dest.Additional = copyStringFloatMap(src.Additional)
}
+ if len(src.SMART) > 0 {
+ dest.SMART = make([]HostDiskSMARTFrontend, len(src.SMART))
+ for i, disk := range src.SMART {
+ dest.SMART[i] = HostDiskSMARTFrontend{
+ Device: disk.Device,
+ Model: disk.Model,
+ Serial: disk.Serial,
+ WWN: disk.WWN,
+ Type: disk.Type,
+ Temperature: disk.Temperature,
+ Health: disk.Health,
+ Standby: disk.Standby,
+ }
+ }
+ }
return dest
}
diff --git a/internal/models/models_frontend.go b/internal/models/models_frontend.go
index c0b0505120..bdf89a318b 100644
--- a/internal/models/models_frontend.go
+++ b/internal/models/models_frontend.go
@@ -440,9 +440,22 @@ type HostFrontend struct {
// HostSensorSummaryFrontend mirrors HostSensorSummary with primitives for the frontend.
type HostSensorSummaryFrontend struct {
- TemperatureCelsius map[string]float64 `json:"temperatureCelsius,omitempty"`
- FanRPM map[string]float64 `json:"fanRpm,omitempty"`
- Additional map[string]float64 `json:"additional,omitempty"`
+ TemperatureCelsius map[string]float64 `json:"temperatureCelsius,omitempty"`
+ FanRPM map[string]float64 `json:"fanRpm,omitempty"`
+ Additional map[string]float64 `json:"additional,omitempty"`
+ SMART []HostDiskSMARTFrontend `json:"smart,omitempty"` // S.M.A.R.T. disk data
+}
+
+// HostDiskSMARTFrontend represents S.M.A.R.T. data for a disk from a host agent.
+type HostDiskSMARTFrontend struct {
+ Device string `json:"device"` // Device name (e.g., sda)
+ Model string `json:"model,omitempty"` // Disk model
+ Serial string `json:"serial,omitempty"` // Serial number
+ WWN string `json:"wwn,omitempty"` // World Wide Name
+ Type string `json:"type,omitempty"` // Transport type: sata, sas, nvme
+ Temperature int `json:"temperature"` // Temperature in Celsius
+ Health string `json:"health,omitempty"` // PASSED, FAILED, UNKNOWN
+ Standby bool `json:"standby,omitempty"` // True if disk was in standby
}
// StorageFrontend represents Storage with frontend-friendly field names