lm_sensors的软件可以帮助我们来监控主板,CPU的工作电压,风扇转速、温度等数据。这些数据我们通常在主板的 BIOS也可以看到。当我们可以在机器运行的时候通过lm_sensors随时来监测着CPU的温度变化,可以预防呵保护因为CPU过热而会烧掉。
1. 安装lm_sensors
现在基本上每个Linux都已经有lm_sensors包了,我们主要安装了就可以了。或者我们也可以通过源文件来自己编译。
1)在FC,RH, CENTOS下,用rpm:
[root@securitycn ~]# rpm -ivh lm_sensors-2.10.0-3.1.i386.rpm
3)编译源文件安装
我们可以通过:这里下载源文件
这里我们要注意的问题是要先安装libsysfs库,是Sysfsutils,Sysfsutils-devel软件
tar xzvf lm-sensors-xxx.tar.gz
make user
make user_install testing
下面我们就用一些简单的命令来利用lm_sensors来得到CPU的数据。我们要用root的身份来:
sensors-detect,然后它会自动搜索主板上的chipset和相应的driver,我们全部答YES就可以了
[root@securitycn ~]# sensors-detect
# sensors-detect revision 1.413 (2006/01/19 20:28:00)
This program will help you determine which I2C/SMBus modules you need to
load to use lm_sensors most effectively. You need to have i2c and
lm_sensors installed before running this program.
Also, you need to be `root', or at least have access to the /dev/i2c-*
files, for most things.
If you have patched your kernel and have some drivers built in, you can
safely answer NO if asked to load some modules. In this case, things may
seem a bit confusing, but they will still work.
It is generally safe and recommended to accept the default answers to all
questions, unless you know what you're doing.
We can start with probing for (PCI) I2C or SMBus adapters.
You do not need any special privileges for this.
Do you want to probe now? (YES/no):
全部默认YES即可。
然后我们启动lm_sensors :
/etc/init.d/lm_sensors start
Starting lm_sensors: [ OK ]
我们可以通过lsmod来确定我们需要的driver已经加载了没有
lsmod | grep i2c
i2c_isa 9153 2 w83627hf,w83781d
i2c_i801 11341 0
i2c_dev 12613 0
i2c_ec 9025 1 sbs
i2c_core 23745 6 w83627hf,w83781d,i2c_isa,i2c_i801,i2c_dev,i2c_ec
然后我们用sensors的命令就可以了:
[root@securitycn ~]# sensors
w83627hf-isa-0290
Adapter: ISA adapter共2页。
VCore 1: +3.33 V (min = +0.00 V, max = +0.00 V) ALARM
VCore 2: +3.36 V (min = +0.00 V, max = +0.00 V) ALARM
+3.3V: +0.93 V (min = +3.14 V, max = +3.46 V) ALARM










