From 12dc8693c43afb3e844883b9d7c556a11186444c Mon Sep 17 00:00:00 2001 From: rcourtman Date: Thu, 6 Nov 2025 00:24:42 +0000 Subject: [PATCH] Add NVIDIA GPU temperature monitoring support (nouveau driver) - Add nouveau chip recognition to temperature parser - Implement parseNouveauGPUTemps() for NVIDIA GPU temps via nouveau driver - Map "GPU core" sensor to edge temperature field - Supports systems using open-source nouveau driver This complements the AMD GPU support added previously. Systems using the nouveau driver will now see NVIDIA GPU temperatures in the dashboard. For proprietary nvidia driver users, GPU temps are not available via lm-sensors and would require nvidia-smi integration. --- internal/monitoring/temperature.go | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/internal/monitoring/temperature.go b/internal/monitoring/temperature.go index b9097e1..8b79da9 100644 --- a/internal/monitoring/temperature.go +++ b/internal/monitoring/temperature.go @@ -372,6 +372,14 @@ func (tc *TemperatureCollector) parseSensorsJSON(jsonStr string) (*models.Temper Msg("Detected AMD GPU temperature chip") tc.parseGPUTemps(chipName, chipMap, temp) } + + // Handle NVIDIA GPU temperature sensors (nouveau driver) + if strings.Contains(chipLower, "nouveau") { + log.Debug(). + Str("chip", chipName). + Msg("Detected NVIDIA GPU temperature chip (nouveau)") + tc.parseNouveauGPUTemps(chipName, chipMap, temp) + } } // If we got CPU temps, calculate max from cores if package not available @@ -604,6 +612,42 @@ func (tc *TemperatureCollector) parseGPUTemps(chipName string, chipMap map[strin } } +// parseNouveauGPUTemps extracts NVIDIA GPU temperature data from nouveau driver sensors +func (tc *TemperatureCollector) parseNouveauGPUTemps(chipName string, chipMap map[string]interface{}, temp *models.Temperature) { + gpuTemp := models.GPUTemp{ + Device: chipName, + } + + // Nouveau driver typically exposes "GPU core" sensor + for sensorName, sensorData := range chipMap { + sensorMap, ok := sensorData.(map[string]interface{}) + if !ok { + continue + } + + sensorLower := strings.ToLower(sensorName) + tempVal := extractTempInput(sensorMap) + + if math.IsNaN(tempVal) || tempVal <= 0 { + continue + } + + // Nouveau typically has "GPU core" sensor - map to edge temperature + if strings.Contains(sensorLower, "gpu") || strings.Contains(sensorLower, "core") { + gpuTemp.Edge = tempVal + } + } + + // Only add GPU entry if we got a valid temperature + if gpuTemp.Edge > 0 { + temp.GPU = append(temp.GPU, gpuTemp) + log.Debug(). + Str("device", chipName). + Float64("edge", gpuTemp.Edge). + Msg("Parsed NVIDIA GPU (nouveau) temperature") + } +} + // extractTempInput extracts temperature value from sensor data func extractTempInput(sensorMap map[string]interface{}) float64 { // Look for temp*_input fields