diff --git a/beszel/internal/agent/sensors_windows.go b/beszel/internal/agent/sensors_windows.go index 8ee2c9b..c4b2997 100644 --- a/beszel/internal/agent/sensors_windows.go +++ b/beszel/internal/agent/sensors_windows.go @@ -46,9 +46,10 @@ var lhmFs embed.FS var ( beszelLhm *lhmProcess beszelLhmOnce sync.Once + useLHM = os.Getenv("LHM") == "true" ) -var errNoSensors = errors.New("no sensors found (try running as admin)") +var errNoSensors = errors.New("no sensors found (try running as admin with LHM=true)") // newlhmProcess copies the embedded LHM executable to a temporary directory and starts it. func newlhmProcess() (*lhmProcess, error) { @@ -139,7 +140,7 @@ func (lhm *lhmProcess) cleanupProcess() { } func (lhm *lhmProcess) getTemps(ctx context.Context) (temps []sensors.TemperatureStat, err error) { - if lhm.stoppedNoSensors { + if !useLHM || lhm.stoppedNoSensors { // Fall back to gopsutil if we can't get sensors from LHM return sensors.TemperaturesWithContext(ctx) } @@ -222,6 +223,10 @@ func getSensorTemps(ctx context.Context) (temps []sensors.TemperatureStat, err e } }() + if !useLHM { + return sensors.TemperaturesWithContext(ctx) + } + // Initialize process once beszelLhmOnce.Do(func() { beszelLhm, err = newlhmProcess()