`

CPU 温度监控软件(lm_sensors)

阅读更多




在 CentOS 上安装 CPU 温度监控软件(lm_sensors)

前段时间新装了一台服务器,系统是 CentOS 5.4 x64,托管在天通苑的一个机房里,上次去装机器的时候注意到他们机房有时候不开空调,机房内温度很高,所以有点不放心,所以想装一个 CPU 温度监控软件方便随时查看机器是否在正常温度下工作。

查了些资料,基本都是 lm_sensors 的,网上说的都很简单,看了几遍后心中比较有数了,就开始动手。本以为会很顺利,结果走了不少弯路,查了很多资料才最终安装成功成。现在在这里记下一些网上的文章都没有提到的细节,正是这些细节让我走了不少弯路。





先安装 lm_sensors:
[root@www ~]# yum install lm_sensors

安装完毕后运行 sensors-detect:
[root@www ~]# /usr/sbin/sensors-detect

然后一路回车,到了最后的时候出现了这个:
Do you want to overwrite /etc/sysconfig/lm_sensors? (YES/no):
Starting lm_sensors: No sensors found!
Make sure you loaded all the kernel drivers you need.
Try sensors-detect to find out which these are.

[FAILED]

网上查了下,很多的朋友也都碰到这个问题,但都不知道怎么解决,没有经验可以借鉴,只好自力更生了。

最后google到一个线索:使用最新版的 sensors-detect。于是下载最新版的 sensors-detect:
[root@www ~]# wget http://dl.lm-sensors.org/lm-sensors/files/sensors-detect
[root@www ~]# chmod u+x sensors-detect
[root@www ~]# ./sensors-detect



这次安装还是没成功,但是,非常重要的是,这个新版的sensors-detect给出了失败的原因:

Warning: the required module coretemp is not currently installed
on your system. If it is built into the kernel then it’s OK.
Otherwise, check http://www.lm-sensors.org/wiki/Devices for
driver availability.

Warning: the required module ipmisensors is not currently installed
on your system. If it is built into the kernel then it’s OK.
Otherwise, check http://www.lm-sensors.org/wiki/Devices for
driver availability.

No modules to load, skipping modules configuration.

有了错误原因,解决起来就好办了,google这个 coretemp ,找到了这篇post:

http://www.centos.org/modules/newbb/viewtopic.php?topic_id=14748

我是个懒人,直接用6楼提供的rpm安装了:
[root@www ~]# wget http://www.cs.vsu.ru/~raskhozhev/files/dkms-coretemp-1.00-1.noarch.rpm
[root@www ~]# rpm -i dkms-coretemp-1.00-1.noarch.rpm

提示需要这个rpm包依赖 dkms 包,那就装吧:
[root@www ~]# yum install dkms

”dkms-2.1.1.2-1.el5.rf.noarch.rpm“

安装不成功,会提示安装 kernel-devel,




[root@www ~]# rpm -i dkms-coretemp-1.00-1.noarch.rpm

成功了,接着重新开始 sensors-detect:

[code="java"][root@www~]/usr/sbin/sensors-detect
[code="java"] sensors-detect
Now follows a summary of the probes I have just done.
Just press ENTER to continue:

Driver `coretemp':
  * Chip `Intel Core family thermal sensor' (confidence: 9)

Do you want to overwrite /etc/sysconfig/lm_sensors? (YES/no):
Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors
for initialization at boot time.
You should now start the lm_sensors service to load the required
kernel modules.

Unloading i2c-dev... OK



启动服务:    service sensors start
 

终于看到绿色OK,启动 lm_sensors:
[root@www ~]# sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0:      +34°C  (high =  +100°C)

coretemp-isa-0001
Adapter: ISA adapter
Core 1:      +34°C  (high =  +100°C)

总结:
Linux Kernel 2.6.22 以上才自带 coretemp,CentOS 5.4 使用的是 Kernel 2.6.18,所以没有自带这个模块,需要自己patch或者安装第三方做好的rpm


lm_sensors 需要 coretemp 模块,否则无法找到传感器。


上面的错误信息也提到缺少 ipmisensors 模块(如果装上这个模块,lm_sensors 好像还可以查看风扇转速、CPU电压等其他信息,但我不需要这些,所以没装),但如果不装,也能查看CPU温度





转自:http://liang.eu/servers/install-lm_sensors-on-centos-5-4-64bit

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics