-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
temperature on rasbian #391
Comments
I can confirm on raspbian on an old Raspberry Model B 512 Mb. This is the same behavior as psutil too. Note this line in python psutil that says that |
I want to take a note in here.. #!/bin/bash
cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp)
cpuTemp1=$(($cpuTemp0/1000))
cpuTemp2=$(($cpuTemp0/100))
cpuTempM=$(($cpuTemp2 % $cpuTemp1))
gpuTemp0=$(/opt/vc/bin/vcgencmd measure_temp)
gpuTemp0=${gpuTemp0//\'/º}
gpuTemp0=${gpuTemp0//temp=/}
echo CPU Temp: $cpuTemp1"."$cpuTempM"ºC"
echo GPU Temp: $gpuTemp0 |
Not getting any temperatures either on Pi Zero W with the latest image of Raspian Strech Lite. cjbassi/gotop#37 edit: and same issue on a Raspberry Pi Model 3 B+ |
I pushed a commit in https://github.com/Lomanic/gopsutil/tree/issue391, this is what is returned on a RPi model 1 B 512 MB
package main
// https://github.com/shirou/gopsutil/issues/340
import (
"fmt"
"os"
"github.com/shirou/gopsutil/host"
)
func main() {
temps, err := host.SensorsTemperatures()
if err != nil {
fmt.Println("err:", err)
os.Exit(1)
}
for _, t := range temps {
fmt.Printf("%+v\n", t)
}
} I see in https://github.com/cjbassi/gotop/blob/9bde31ff9ace22a5f667e9037e69713fa134653b/src/widgets/temp_linux.go#L21 that you check if a sensor name finishes with Using only thermal readings, results are even different on my x64 Dell laptop
So this bears the question, shall we append |
hwmon driver will be enabled by default in next kernel version (current is 4.19) of Raspbian, see raspberrypi/linux#2182 (comment) |
Hi there. Why we can't create PR with @Lomanic's commit. It's looking fine and resolves the issue as i may see. About my case. $ uname -srm
Linux 5.4.0-1008-raspi aarch64 I've installed telegraf (by influxdata) agent to achieve monitoring goals. |
Just tested my old branch on my Raspberry Pi and returned value (bcm2835_thermal) is the same as psutil (reading thermal_zone files was implemented in psutil in giampaolo/psutil#1345), so this should be OK regarding API. Using the previous test program and
(our TemperatureStat type doesn't include high and critical values)
I didn't create the corresponding PR at the time because of my concerns expressed in the last paragraph of #391 (comment), as it changes the API with different values returned. But as psutil doesn't change their name like I was suggesting, we are already aligned with it and can move forward. |
[host][linux] Fix #391 retrieve sensors temps on OSes lacking hwmon
Hi,
On Rasbian (ARMv6 )
host.SensorsTemperatures()
return[]
I found the right place to get CPU temp is
/sys/class/thermal/thermal_zone*
and not
/sys/class/hwmon/hwmon*/temp*_*
The text was updated successfully, but these errors were encountered: