Reading CPU and HDD temperatures from CLI

Discussion on apps, protocols, APIs, specifications, and more. You are welcome to join us as a TOS app developer!
Post Reply
User avatar
f18m
Posts: 9
Joined: 13 Sep 2023, 05:28

Reading CPU and HDD temperatures from CLI

Post by f18m »

Hi all,
I'd like to put in cron a simple script to log CPU and HDD temperatures on my F2-210 (ARM Cortex A53) using TOS 4.
I do have SSH access... I tried to search for some utility in the filesystem to do that, but failed (*)

Is there a path exposed under /proc or /sys with the temperatures?
Or some utility like lm_sensors for TOS4 ?

Thanks!

(*) I did find a /usr/bin/hddtemp utility but that fails to read HDD temperature... which however showsup just fine in the "Hardware Info" panel of TOS4...
User avatar
TMzethar
TerraMaster Team
Posts: 1229
Joined: 27 Oct 2020, 16:43

Re: Reading CPU and HDD temperatures from CLI

Post by TMzethar »

TOS uses the SMART tool to obtain the temperature of the hard drive. You can also manually obtain the temperature information of the hard drive through this command:

Code: Select all

smartctl -A /dev/sd? |grep Temperature
To contact our team, please send email to following addresses, remember to replace (at) with @:
Technical team: support(at)terra-master.com (for technical support)
Service team: service(at)terra-master.com (for purchasing, return, replacement, RMA service)
User avatar
f18m
Posts: 9
Joined: 13 Sep 2023, 05:28

Re: Reading CPU and HDD temperatures from CLI

Post by f18m »

Ok thanks! Good point!
What about the CPU? I found /sys/devices/virtual/thermal/thermal_zone0/temp but how do I convert that number to Celsius degrees?
Thanks!
User avatar
TMzethar
TerraMaster Team
Posts: 1229
Joined: 27 Oct 2020, 16:43

Re: Reading CPU and HDD temperatures from CLI

Post by TMzethar »

Code: Select all

ec_stat -rct
(read CPU temperature)
To contact our team, please send email to following addresses, remember to replace (at) with @:
Technical team: support(at)terra-master.com (for technical support)
Service team: service(at)terra-master.com (for purchasing, return, replacement, RMA service)
User avatar
f18m
Posts: 9
Joined: 13 Sep 2023, 05:28

Re: Reading CPU and HDD temperatures from CLI

Post by f18m »

Actually I don't have that tility ec_stat on my TNAS... where can I grab it ?
User avatar
TMzethar
TerraMaster Team
Posts: 1229
Joined: 27 Oct 2020, 16:43

Re: Reading CPU and HDD temperatures from CLI

Post by TMzethar »

Sorry, I just noticed that you are using the F2-210 model with arm architecture.
Please use this to get CPU temperature:

Code: Select all

cat /sys/class/thermal/thermal_zone0/temp | awk '{print ($1 / 1000) - 18}'
To contact our team, please send email to following addresses, remember to replace (at) with @:
Technical team: support(at)terra-master.com (for technical support)
Service team: service(at)terra-master.com (for purchasing, return, replacement, RMA service)
Post Reply

Return to “Developer Discussion Room”