lm_sensors: マザーボード上の温度センサーなどから情報を取得

lm_sensors


先日、muninを設定しましたが、現状では、監視項目の中に CPU やシステムの温度が含まれていません。今日は、それらの温度を監視するための前準備として、lm_sensorsの設定をします。

lm_sensors は、マザーボードに乗っている石などから各所の温度や、マザーボードに供給されている各種電圧の状態、繋がれているファンの回転数など(BIOSの設定画面で見ることが出来るアレ、と言ったほうが通りが良いかもしれませんね)を表示するためのソフトです。

この情報表示は、マザーボードの設計によって極端に違いが出るところですし、取得方法を正式に公開しているメーカーも(私の知る限り)存在しないので、それらしい値を表示させるだけでも、色々と手を加える必要がある場合が多いです。以下に書くのは私が使用している ABITのVA-20というマザーボードでの場合ですので、参考にされる場合は注意してください。

インストール

まずはいつもの通り yum でインストール。

# yum install lm_sensors
(略)
Installed: lm_sensors.i386 0:2.10.0-3.1
Complete!

とりあえず自動検出

まずは、自動検出に任せて設定してみましょう。

自動検出設定ツールは sensors-detect です。途中、幾つか質問されますが、全て、何も考えずにEnterを押しました(^^;

一応、最後の選択肢

Do you want to generate /etc/sysconfig/lm_sensors? (YES/no): 

以外は、「○○の検出を試してみる?(YES/no)」ばかりなので、「Yesを選んだらPCがハングした」とかで無い限りはYesで良い筈です。(最後の選択肢については後述)

とりあえず、私の場合のログをまるごと貼っておきます。

# 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): 
Probing for PCI bus adapters...
Use driver `i2c-viapro' for device 00:11.0: VIA Technologies VT8237 South Bridge
Probe succesfully concluded.

We will now try to load each adapter module in turn.
Module `i2c-viapro' already loaded.
If you have undetectable or unsupported adapters, you can have them
scanned by manually loading the modules before running this script.

 To continue, we need module `i2c-dev' to be loaded.
 If it is built-in into your kernel, you can safely skip this.
 i2c-dev is not loaded. Do you want to load it now? (YES/no): 
 Module loaded succesfully.

 We are now going to do the adapter probings. Some adapters may hang halfway
 through; we can't really help that. Also, some chips will be double detected;
 we choose the one with the highest confidence value in that case.
 If you found that the adapter hung after probing a certain address, you can
 specify that address to remain unprobed. That often
 includes address 0x69 (clock chip).

Next adapter: SMBus Via Pro adapter at 5000
Do you want to scan it? (YES/no/selectively): 
Client found at address 0x30
Client found at address 0x50
Probing for `SPD EEPROM'... Success!
    (confidence 8, driver `eeprom')
Probing for `DDC monitor'... Failed!
Probing for `Maxim MAX6900'... Failed!
Client found at address 0x69

Some chips are also accessible through the ISA bus. ISA probes are
typically a bit more dangerous, as we have to write to I/O ports to do
this. This is usually safe though.

Do you want to scan the ISA bus? (YES/no): 
Probing for `National Semiconductor LM78'
  Trying address 0x0290... Failed!
Probing for `National Semiconductor LM78-J'
  Trying address 0x0290... Failed!
Probing for `National Semiconductor LM79'
  Trying address 0x0290... Failed!
Probing for `Winbond W83781D'
  Trying address 0x0290... Failed!
Probing for `Winbond W83782D'
  Trying address 0x0290... Failed!
Probing for `Winbond W83627HF'
  Trying address 0x0290... Failed!
Probing for `Winbond W83627EHF'
  Trying address 0x0290... Failed!
Probing for `Silicon Integrated Systems SIS5595'
  Trying general detect... Failed!
Probing for `VIA Technologies VT82C686 Integrated Sensors'
  Trying general detect... Failed!
Probing for `VIA Technologies VT8231 Integrated Sensors'
  Trying general detect... Failed!
Probing for `ITE IT8712F'
  Trying address 0x0290... Success!
    (confidence 8, driver `it87')
Probing for `ITE IT8705F / SiS 950'
  Trying address 0x0290... Failed!
Probing for `IPMI BMC KCS'
  Trying address 0x0ca0... Failed!
Probing for `IPMI BMC SMIC'
  Trying address 0x0ca8... Failed!

Some Super I/O chips may also contain sensors. Super I/O probes are
typically a bit more dangerous, as we have to write to I/O ports to do
this. This is usually safe though.

Do you want to scan for Super I/O sensors? (YES/no): 
Probing for `ITE 8702F Super IO Sensors'
  Failed! (0x8705)
Probing for `ITE 8705F Super IO Sensors'
  Success... found at address 0x0290
Probing for `ITE 8712F Super IO Sensors'
  Failed! (0x8705)
Probing for `Nat. Semi. PC87351 Super IO Fan Sensors'
  Failed! (skipping family)
Probing for `SMSC 47B27x Super IO Fan Sensors'
  Failed! (skipping family)
Probing for `VT1211 Super IO Sensors'
  Failed! (skipping family)
Probing for `Winbond W83627EHF/EHG Super IO Sensors'
  Failed! (skipping family)

Do you want to scan for secondary Super I/O sensors? (YES/no): 
Probing for `ITE 8702F Super IO Sensors'
  Failed! (0x8705)
Probing for `ITE 8705F Super IO Sensors'
  Success... found at address 0x0290
Probing for `ITE 8712F Super IO Sensors'
  Failed! (0x8705)
Probing for `Nat. Semi. PC87351 Super IO Fan Sensors'
  Failed! (skipping family)
Probing for `SMSC 47B27x Super IO Fan Sensors'
  Failed! (skipping family)
Probing for `VT1211 Super IO Sensors'
  Failed! (skipping family)
Probing for `Winbond W83627EHF/EHG Super IO Sensors'
  Failed! (skipping family)

 Now follows a summary of the probes I have just done.
 Just press ENTER to continue: 

Driver `eeprom' (should be inserted):
  Detects correctly:
  * Bus `SMBus Via Pro adapter at 5000'
    Busdriver `i2c-viapro', I2C address 0x50
    Chip `SPD EEPROM' (confidence: 8)

Driver `it87' (should be inserted):
  Detects correctly:
  * ISA bus address 0x0290 (Busdriver `i2c-isa')
    Chip `ITE 8705F Super IO Sensors' (confidence: 9)


I will now generate the commands needed to load the I2C modules.

To make the sensors modules behave correctly, add these lines to
/etc/modprobe.conf:

#----cut here----
# I2C module options
alias char-major-89 i2c-dev
#----cut here----

To load everything that is needed, add this to some /etc/rc* file:

#----cut here----
# I2C adapter drivers
modprobe i2c-viapro
modprobe i2c-isa
# I2C chip drivers
modprobe eeprom
modprobe it87
# sleep 2 # optional
/usr/bin/sensors -s # recommended
#----cut here----

WARNING! If you have some things built into your kernel, the list above
will contain too many modules. Skip the appropriate ones! You really should
try these commands right now to make sure everything is working properly.
Monitoring programs won't work until it's done.

Do you want to generate /etc/sysconfig/lm_sensors? (YES/no): 
Copy prog/init/lm_sensors.init to /etc/rc.d/init.d/lm_sensors
for initialization at boot time.

最後の選択肢はYesと答えると、検出されたモジュールのリストがそのファイルに書かれ、 lm_sensors サービスを有効にしておけば、システム起動時に自動でそれらのモジュールが読み込まれるようになります。

というわけで、chkconfig で lm_sensors サービスを有効にします。

# /sbin/chkconfig --list lm_sensors
lm_sensors     	0:off	1:off	2:on	3:on	4:on	5:on	6:off
# /sbin/service lm_sensors start
Starting lm_sensors:                                       [  OK  ]

動作テスト

最低限の設定が済んだら出力を確認してみましょう。sensorsコマンドを使います。

# sensors
it87-isa-0290
Adapter: ISA adapter
VCore 1:   +1.14 V  (min =  +1.42 V, max =  +1.57 V)   ALARM
VCore 2:   +2.50 V  (min =  +2.40 V, max =  +2.61 V)   
+3.3V:     +3.23 V  (min =  +3.14 V, max =  +3.47 V)   
+5V:       +4.92 V  (min =  +4.76 V, max =  +5.24 V)   
+12V:     +12.35 V  (min = +11.39 V, max = +12.61 V)   
-12V:     -27.36 V  (min = -12.63 V, max = -11.41 V)   ALARM
-5V:      -13.64 V  (min =  -5.26 V, max =  -4.77 V)   ALARM
Stdby:     +4.60 V  (min =  +4.76 V, max =  +5.24 V)   ALARM
VBat:      +4.08 V
fan1:     3750 RPM  (min =    0 RPM, div = 8)          
fan2:        0 RPM  (min = 3013 RPM, div = 8)          
fan3:        0 RPM  (min = 3013 RPM, div = 8)          
M/B Temp:    +41°C  (low  =   +15°C, high =   +40°C)   sensor = thermistor   
CPU Temp:    +22°C  (low  =   +15°C, high =   +45°C)   sensor = diode   
Temp3:      +127°C  (low  =   +15°C, high =   +45°C)   sensor = thermistor   

うん、けっこう酷い数字ですね(笑)。おかしい表示の部分を順に見ていきましょう。

VCore1 が低いのは、これで正常です。というのも、私が使っているCPUはGeode NX 1500なので、普通のデスクトップ用マザーボードのVA-20で動かした時の認識電圧は 1.175 Vとなるからです。 (参考: Fab51) できることなら定格の1.0Vで動かしたいぐらいなんですが、ともかく、この値はこれでOK、と。

次に、-12V,-5V, Stdbyですが、これはBIOSの画面でも確認出来ないので、このマザボではそもそもセンサーに繋がってないのかもしれません。 同様に fan3 と Temp 3 もBIOSで該当する表示がみあたりません。あと、本質は同じなのですが、BIOSでは "VCore 2" ではなく、 "+2.5V"という表記になっていました。

というわけで、これらの不具合を調整するために、 /etc/sensors.conf を修正します。修正点は以下の通り。

  • VCore 1, VCore 2の表記を VCore, +2.5V に変える
  • -12V, -5V, Stdby ピンを無効にする
  • VCore の期待する正常値を 1.175 V とする
  • fan3, temp3 を無効にする

具体的な修正内容は以下の通りです。

--- sensors.conf	2008/06/27 14:02:40	1.1
+++ sensors.conf	2008/06/29 14:32:20	1.2
@@ -1504,13 +1504,16 @@
 
 # Voltage monitors as advised in the It8705 data sheet
 
-    label in0 "VCore 1"
-    label in1 "VCore 2"
+    label in0 "VCore"
+    label in1 "+2.5V"
     label in2 "+3.3V"
     label in3 "+5V"
     label in4 "+12V"
+    ignore in5
     label in5 "-12V"
+    ignore in6
     label in6 "-5V"
+    ignore in7
     label in7 "Stdby"
     label in8 "VBat"
 
@@ -1561,8 +1564,8 @@
 #
     compute in7 ((6.8/10)+1)*@ ,  @/((6.8/10)+1)
 
-    set in0_min 1.5 * 0.95
-    set in0_max 1.5 * 1.05
+    set in0_min 1.175 * 0.95
+    set in0_max 1.175 * 1.05
     set in1_min 2.4
     set in1_max 2.6
     set in2_min 3.3 * 0.95
@@ -1599,7 +1602,7 @@
     label temp2       "CPU Temp"
     set   temp2_over  45
     set   temp2_low   15
-#   ignore temp3
+    ignore temp3
     label temp3       "Temp3"
     set   temp3_over  45
     set   temp3_low   15
@@ -1619,7 +1622,7 @@
 # Fans
     set fan1_min 0
     set fan2_min 3000
-#   ignore fan3
+    ignore fan3
     set fan3_min 3000
 
 # The following is for the Inside Technologies 786LCD which uses either a

これで、表示は以下のようになりました。

$sensors
it87-isa-0290
Adapter: ISA adapter
VCore:     +1.14 V  (min =  +1.12 V, max =  +1.23 V)   
+2.5V:     +2.48 V  (min =  +2.40 V, max =  +2.61 V)   
+3.3V:     +3.23 V  (min =  +3.14 V, max =  +3.47 V)   
+5V:       +4.92 V  (min =  +4.76 V, max =  +5.24 V)   
+12V:     +12.35 V  (min = +11.39 V, max = +12.61 V)   
VBat:      +3.28 V
fan1:     3835 RPM  (min =    0 RPM, div = 8)          
fan2:        0 RPM  (min = 3013 RPM, div = 8)          
M/B Temp:    +43°C  (low  =   +15°C, high =   +40°C)   sensor = thermistor   
CPU Temp:    +24°C  (low  =   +15°C, high =   +45°C)   sensor = diode   

BIOSの画面で見たものと比べてみると、VBatはBIOSでは 3.3 Vと出ていたので、まだ表示が狂っています。計算式が違っているのでしょうが、まぁ、面倒なので、こいつは放置しときます。

常時監視の対象にする

さて、これでセンサーの値を取得できるようになったわけですが、あとはこれを常時監視するようにしなければなりません。

が、今日は眠いのでここまで。

続きは明日以降に……。