ソフトウェアでlm_sensorsはLinuxシステムとCPU温度を監視する


Linuxの下に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)I 2 C 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]を起動します必要なdriverがlsmod|grep i 2 c i 2 c_をロードしていないことをlsmodで確認できます.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 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 +5V: +5.11 V (min = +4.73 V, max = +5.24 V) +12V: +4.56 V (min = +10.82 V, max = +13.19 V) ALarm -12V: -7.10 V (min = -13.18 V, max = -10.88 V) ALarm -5V: -1.93 V (min = -5.25 V, max = -4.75 V) ALarm V5SB: +5.51 V (min = +4.73 V, max = +5.24 V) ALarm VBat: +0.02 V (min = +2.40 V, max = +3.60 V) ALarm fan1: 0 RPM (min=2732 RPM,div=2)ALarm fan 2:0 RPM(min=0 RPM,div=2)fan 3:0 RPM(min=0 RPM,div=2)temp 1:+38℃(high=+50℃,hyst=+45℃)sensor=thermistor temp 2:+33.5℃(high=+80℃,hyst=+75℃)sensor=thermistor temp 3:+33.5℃((high=+80℃,hyst=+75℃)sensor=thermistor vid:+0.000 V(VRM Version 10.0)alarm s:beep_enable:Sound alarm enabledここでは温度がまだ対応していないCPUを見ることができます.主に/etc/sensors.confを少し修正すればいいのですが、実際には自分で手を出す必要はありません.一般的にはマザーボードの生産者からプロファイルをダウンロードすることができます.lmsensorsでマザーボードの温度を得ることができます.度、CPU電圧、ファン回転数などの情報が表示されます.これらのデータに基づいてシステムの稼働状況を監視し、システムの問題を予防することができます.次にMRTGと統合させましょう[root@securitycn ~]# cd/usr/local/mrtg/bin [root@securitycn ~]# vi temp.sh#の内容は以下の通りです!/bin/bash cputemp=`/usr/bin/sensors|grep temp 1|awk'{print$2}'|cut-c 2-4``という文はtemp 1の行があり、2列目の2-4文字systemp=`/usr/bin/sensors|grep temp 2|awk'{print$2}'|cut-c 2-5`は解釈するまでもないでしょecho$cputemp echo$systemp#the time uptime|sesed|sed:^.****:^h h h h|sed:^.*up/(.*/), [0-9][0-9]* users.*$:/1:' # my name uname -n [root@securitycn ~]# chmod +x temp.sh実行可能に変更[root@securitycn ~]# ./temp.sh問題があるかどうか試してみます39,33.5 15:36:19 up 22:28,1 user,load average:0.04,0.09,0.04 securitycn次のファイルを書きます[root@securitycn ~]# cd ……/etc/ [root@securitycn ~]# vi temp.cfg WorkDir:/data1/usr/apache/htdocs/mrtg/temp/ Target[index]: `/usr/local/mrtg/bin/temp.sh`MaxBytes[index]:80 Options[index]:gauge,nopercent,growright YLegend[index]:Temp(度)ShortLegend[index]:度LegendO[index]:システム温度;LegendI[index]:CPU温度;Title[index]:システム温度計PageTop[index]:ホスト温度計[root@securitycn ~]#/usr/local/mrtg/bin/mrtg/usr/local/mrtg/etc/temp.cfgは3回実行するとエラーを報告せずにcrontabに*/5***/usr/local/mrtg/bin/mrtg/usr/local/mrtg/etc/tempに加える.cfg
 
 
lmsensorsの構成とカーネルオプション、およびcpuとバスの駆動相関が大きいため
失敗した場合は、マザーボードのモデルと対応する温度センサーを確認してください.lm-sensorsの公式サイトにはDevice Support Statusがリストされています.http://www.lm-sensors.org/wiki/Devices
lm_sensors on 2.6.x kernelsRecommended Kernel Configuration
  Code maturity level options
[*] Prompt for development and/or incomplete code/drivers

Bus options (PCI, PCMCIA, EISA, MCA, ISA)
[*] PCI support

Device Drivers
I2C support
<M> I2C support
<M> I2C device interface
I2C Algorithms
<M> (configure all of them as modules)
I2C Hardware Bus support
<M> (configure all of them as modules)
I2C Hardware Sensors Chip support (up to 2.6.12)
<M> (configure all of them as modules)
Hardware Monitoring support (since 2.6.13)
<M> (configure all of them as modules)

and mainboard configuration:Motherboard Specific Configuration