suse linux view cpu speed and hard disk/cpu temperature

I have a laptop which sometime goes really hot and I wanted a simple way to be able to view CPU and Hard disk temperature. I' m on SUSE 10.3 and I tried installing LM-sensors but no sensors were detected. After a very little search I found that you can view the CPU speed by using the cpufrequtils so I installed the package using Yast and executed cpufreq-info.
Here is the output:
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. cpufrequtils 002: cpufreq-info (C) Dominik Brodowski 2004-2006 Report errors and bugs to http://bugs.opensuse.org, please. analyzing CPU 0:   driver: acpi-cpufreq   CPUs which need to switch frequency at the same time: 0   hardware limits: 798 MHz - 2.00 GHz   available frequency steps: 2.00 GHz, 1.60 GHz, 1.33 GHz, 1.06 GHz, 798 MHz   available cpufreq governors: conservative, userspace, powersave, ondemand, performance   current policy: frequency should be within 798 MHz and 2.00 GHz.                   The governor "ondemand" may decide which speed to use                   within this range.   current CPU frequency is 798 MHz (asserted by call to hardware).
Download The Code

I was a little excited but I wanted to view the CPU and the hard disk temperature too.
I found that I could see CPU temperature with the command:
1. cat /proc/acpi/thermal_zone/THRM/temperature

and the hard disk temperature (and some other stuff if you don't use grep) with
1. smartctl -d ata -A /dev/sda3 | grep -i temperature

where sda3 is my hard disk partition where linux are installed but actually it doesn't matter. ( I think :-P)

Now we know the commands and we have the tools we need.
But hold on a second, Can't we make it better?
Of course we can, we are talking about computers here!
So I wrote this simple shell script
1. 2. 3. 4. 5. 6. 7. cpufreq-info | grep -i "current CPU frequency"; cat /proc/acpi/thermal_zone/THRM/temperature | awk '{ printf("  CPU Temperature\t= " $2"\n") }'; smartctl -d ata -A /dev/sda3 | grep -i temperature | awk '{ printf("  Hard disk Temperature = " $10"\n") }'

and saved it in a file named temperature.
I gave it execution permission using
chmod +x temperature
and I was able to see the CPU speed and temperature and the Hard disk temperature too
by using 
./temperature
and that's it.
This is my output.
1. 2. 3. 4. 5. 6. blablabla/Temperature # ./temperature   current CPU frequency is 798 MHz (asserted by call to hardware).   CPU Temperature       = 51   Hard disk Temperature = 54 blablabla/Temperature # 

Yeap, a little hot, but it can be hotter so it's ok... :-P
After that I wrote a little C code to have the script executed
from a program but I will explain it in another post very soon!

I hope this work for you too.
Thank you all for visiting,reading and posting your comments.

No comments:

Post a Comment