Jump to content

Get cpu temp?


jdbrubaker

Recommended Posts

Hi - First let me say how gratefull I am for an Armbian version that works with my NanoPi M4 board!  I am using the board as a web server and it is rock solid.  My question is about the information that is displayed when I log in to my board using SSH.  There is information about cpu temp,  up time, etc.  How is this information extracted and displayed?  I am a Linux noob and I would like to understand how to get the cpu temp and other info to use at other times.  Please help me as I am just starting out with SBC's.  thanks---jb.

Link to comment
Share on other sites

I'm no expert, but if it helps, I believe its available via the kernel. See:

https://www.kernel.org/doc/Documentation/thermal/sysfs-api.txt

 

In terms of how its displayed when you login to the terminal, you may like to look for a bash script here:

/etc/update-motd.d/30-armbian-sysinfo

It includes a bash function which looks for tools like /usr/bin/temper or /usr/bin/armbianmonitor and chops up the text ouput from them.

 

In practical terms, you can find it in:
 

root@nanopct4:~# cat /sys/class/thermal/thermal_zone0/type
soc-thermal

root@nanopct4:~# cat /sys/class/thermal/thermal_zone0/temp
41111

 

On my device, zone0 seems to be the CPU temp, and zone1 seems to be the GPU temp.

 

If you wanted to do it programmatically, I'm sure Python and Java and other languages will have libraries you could use to read such data via API's if thats your preference.

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines