A self-hosted dashboard that puts all your feeds in one place
Go aggregatordashboarddockerfeed-readergohomelabhomepagemonitoringredditrssrss-readerself-hostedstartpageyoutube
[sensors] allow sensor readings when there are warnings
anxdpanic41e74ba9b531
diff --git a/internal/glance/cli.go b/internal/glance/cli.goindex 8e0fc32..34c8dff 100644--- a/internal/glance/cli.go+++ b/internal/glance/cli.go@@ -96,22 +96,22 @@ func parseCliOptions() (*cliOptions, error) {func cliSensorsPrint() int {tempSensors, err := sensors.SensorsTemperatures()if err != nil {- fmt.Printf("Failed to retrieve list of sensors: %v\n", err)+ fmt.Printf("Errors encountered while retrieving list of sensors:\n %v\n", err)if warns, ok := err.(*sensors.Warnings); ok {for _, w := range warns.List {fmt.Printf(" - %v\n", w)}}- return 1}- if len(tempSensors) == 0 {+ if tempSensors == nil || len(tempSensors) == 0 {fmt.Println("No sensors found")return 0}+ fmt.Println("Sensors found:")for _, sensor := range tempSensors {- fmt.Printf("%s: %.1f°C\n", sensor.SensorKey, sensor.Temperature)+ fmt.Printf(" %s: %.1f°C\n", sensor.SensorKey, sensor.Temperature)}return 0diff --git a/pkg/sysinfo/sysinfo.go b/pkg/sysinfo/sysinfo.goindex 1ed8c75..9a35710 100644--- a/pkg/sysinfo/sysinfo.go+++ b/pkg/sysinfo/sysinfo.go@@ -205,7 +205,7 @@ func Collect(req *SystemInfoRequest) (*SystemInfo, []error) {// also disabled on openbsd because it's not implemented by go-psutilif runtime.GOOS != "windows" && runtime.GOOS != "openbsd" {sensorReadings, err := sensors.SensorsTemperatures()- if err == nil {+ if sensorReadings != nil && len(sensorReadings) > 0 {if req.CPUTempSensor != "" {for i := range sensorReadings {if sensorReadings[i].SensorKey == req.CPUTempSensor {