IceWhaleTech / CasaOS

CasaOS - A simple, easy-to-use, elegant open-source Personal Cloud system.
https://casaos.io
Apache License 2.0
25.62k stars 1.39k forks source link

[Feature request] Support AMD CPUs for WebUI CPU Watt usage and Temperature #1126

Open IaonnisPrysma opened 1 year ago

IaonnisPrysma commented 1 year ago

Is your feature request related to a problem? Please describe.

Is frustrating to not be able to see the power usage and temperature of the CPU, I know I can see it with powertop and lm-sensors as I have been doing since using CasaOS. Still not ideal for seeing it faster My CPU is an Ryzen 3 3200U, the device used as server is a laptop, I'm using Debian 11 minimal with nothing but basic system utils and OpenSSH.

image

Describe the solution you'd like To have on the UI the Temperature and Watt usage on AMD CPUs

Additional context Consider it would be a luxury to also have CPU frecuencies (by core) on some place on the WebUI. Anyways I'm grateful for this software, has been really good for my DDNS, Game servers and File hosting.

raller1028 commented 1 year ago

Can you try this command to see if you can read the cpu temperature? cat /sys/class/thermal/thermal_zone0/temp

IaonnisPrysma commented 1 year ago

cat /sys/class/thermal/thermal_zone0/temp](cat: /sys/class/thermal/thermal_zone0/temp: No such file or directory

Is that file part of a package I can download? I read temps with lm-sensors

LinkLeong commented 1 year ago

@IaonnisPrysma Is it convenient to look at this path '/sys/devices/virtual/thermal/thermal_zone0/temp' if not, look at '/sys/devices/virtual/thermal' to see what's under this path

Nsbx commented 1 year ago

I tried all path and all of them give "No data available" I also tried "cat /sys/class/thermal/thermal_zone*/temp" I found nothing I'm on ubuntu server last version also with amd cpu

raller1028 commented 1 year ago

@Nsbx Can you check the temperature of the cpu with other third party tools, or command line commands?

IaonnisPrysma commented 1 year ago

I personally can with powertop (already included in my system) and lm-sensors (needs to be downloaded)

I'm on lastest debian with only basic components and ssh server, no desktop.

raller1028 commented 1 year ago

@IaonnisPrysma

Issue with CPU temperature showing as 0

Currently, CasaOS only supports temperature readings directly provided by the CPU and does not support readings from external sensors. image To confirm the type of temperature monitoring device your system is using, you can use the following command: cat /sys/devices/virtual/thermal/thermal_zone*/type To obtain the temperature reading from the corresponding device, use the following command: cat /sys/devices/virtual/thermal/thermal_zone*/temp Here are some examples: image {"cpu-thermal": "39704"} image {"acpitz": "31000", "x86_pkg_temp": "31000"} For more types of temperature readings, refer to this link

raller1028 commented 1 year ago

If still have problems, please reopen

shatrix commented 1 year ago

If still have problems, please reopen

Hi, the problem remains with AMD CPUs, I think you should use chekc for the thermal temp file, similar to what's happening with PiHole code, the chec for both files: /sys/devices/virtual/thermal/thermal_zone*/temp /sys/class/hwmon/hwmon0/temp1_input

Here: https://github.com/pi-hole/AdminLTE/blob/master/scripts/pi-hole/php/header_authenticated.php#L67-L73 Code: if (file_exists('/sys/class/thermal/thermal_zone0/temp')) { $output = rtrim(file_get_contents('/sys/class/thermal/thermal_zone0/temp')); } elseif (file_exists('/sys/class/hwmon/hwmon0/temp1_input')) { $output = rtrim(file_get_contents('/sys/class/hwmon/hwmon0/temp1_input')); } else { $output = ''; }

For me on my AMD PC, here's the output $ cat /sys/class/hwmon/hwmon0/temp1_input 30500

Could you please update the code?

akapower commented 8 months ago

Still no read outs

LinkLeong commented 8 months ago

@shatrix Do you have any ideas?