Webmin: Display of CPU Raspberry PI temperature

Created on 25 Aug 2017  路  4Comments  路  Source: webmin/webmin

Hi,

How can you display CPU temperature with Raspberry Pi?
Just enter the command line: "vcgencmd measure_temp". We get the answer: "temp = 39.5'C"
I understand that you should modify the file "system-status-lib.pl", very much ask for help as it should look.

It seems that you need to modify this code:

sub get_current_cpu_temps { my @rv; if (!$config{'collect_notemp'} && $gconfig{'os_type'} =~ /-linux$/ && &has_command("sensors")) { my $fh = "SENSORS"; &open_execute_command($fh, "sensors </dev/null 2>/dev/null", 1); while(<$fh>) { if (/Core\s+(\d+):\s+([\+\-][0-9\.]+)/) { push(@rv, { 'core' => $1, 'temp' => $2 }); } elsif (/CPU:\s+([\+\-][0-9\.]+)/) { push(@rv, { 'core' => 0, 'temp' => $1 }); } } close($fh); } return @rv; }

Best Regards,
Robert

Most helpful comment

#!/bin/bash
# Script: my-pi-temp.sh
# Purpose: Display the ARM CPU and GPU  temperature of Raspberry Pi 2/3 
# Author: Vivek Gite <www.cyberciti.biz> under GPL v2.x+
# -------------------------------------------------------
cpu=$(</sys/class/thermal/thermal_zone0/temp)
echo "$(date) @ $(hostname)"
echo "-------------------------------------------"
echo "GPU => $(/opt/vc/bin/vcgencmd measure_temp)"
echo "CPU => $((cpu/1000))'C"

The vcgencmd only shows the GPU temp (graphics chip).
The script above shows both the CPU (main ARM processor) and GPU temps.

I'm surprised these RPi temp sensors aren't detected by sensors-detect.

I made an issue on the lm-sensors package.
https://github.com/groeck/lm-sensors/issues/30

All 4 comments

What does it say when you run the commands
$ sensors
$ sensors-detect
$ sensors

Sensors do not detect CPU temperature sensors in Raspberry PI. The only possible reading of ARM CPU tempatures in Rapsberry PI is via the command: vcgencmd measure_temp

https://www.cyberciti.biz/faq/linux-find-out-raspberry-pi-gpu-and-arm-cpu-temperature-command
https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=34994

#!/bin/bash
# Script: my-pi-temp.sh
# Purpose: Display the ARM CPU and GPU  temperature of Raspberry Pi 2/3 
# Author: Vivek Gite <www.cyberciti.biz> under GPL v2.x+
# -------------------------------------------------------
cpu=$(</sys/class/thermal/thermal_zone0/temp)
echo "$(date) @ $(hostname)"
echo "-------------------------------------------"
echo "GPU => $(/opt/vc/bin/vcgencmd measure_temp)"
echo "CPU => $((cpu/1000))'C"

The vcgencmd only shows the GPU temp (graphics chip).
The script above shows both the CPU (main ARM processor) and GPU temps.

I'm surprised these RPi temp sensors aren't detected by sensors-detect.

I made an issue on the lm-sensors package.
https://github.com/groeck/lm-sensors/issues/30

Thanks a lot Chris

Was this page helpful?
0 / 5 - 0 ratings

Related issues

muhammadwafa picture muhammadwafa  路  8Comments

SavageCore picture SavageCore  路  8Comments

arndttob picture arndttob  路  4Comments

Enrica-r picture Enrica-r  路  5Comments

pedrom34 picture pedrom34  路  9Comments