Home » Programing, Server » LinuxでCPUの温度を調べる

Check     このエントリーをはてなブックマークに追加

暑い毎日が続いていますが、自宅サーバな方はサーバのCPU温度が気になるものです。

というわけで、本日はLinuxサーバ上でのCPU温度やファンの回転数を計測するlm_sensorsを紹介する。

セットアップ

まずはインストールしよう。今回はyumを利用する。

# yum install lm_sensors

ソースからインストールしたい場合は下記から。
Edge Design - lm_sensors

sensors-detectというコマンドでセットアップする。

# sensors-detect

すると、いろんな質問をしてくるんだが、よく意味がわからないので、Enter連打でOK。そして最後のほうに下記のような指示をしてきます。

CODE:
  1. To make the sensors modules behave correctly, add these lines to
  2. /etc/modprobe.conf:
  3.  
  4. #----cut here----
  5. # I2C module options
  6. alias char-major-89 i2c-dev
  7. #----cut here----
  8.  
  9. To load everything that is needed, add this to some /etc/rc* file:
  10.  
  11. #----cut here----
  12. # I2C adapter drivers
  13. modprobe i2c-i801
  14. # Chip drivers
  15. modprobe w83781d
  16. # sleep 2 # optional
  17. /usr/bin/sensors -s # recommended
  18. #----cut here----

上部のcut hereの中身を/etc/modprobe.confファイルに。そして、下部のcut here部分を/etc/rc.localファイルにそのままコピーして編集してしまおう。

そして、rc.localを実行してする、もしくはサーバを再起動してしまおう。

利用方法

あとは、sensorsコマンドを打つと下記のような結果が返ってくる。

# sensors
as99127f-i2c-0-2d
ERROR: Can't get adapter or algorithm?!?
VCore 1: +1.71 V (min = +1.65 V, max = +2.05 V)
VCore 2: +1.81 V (min = +1.65 V, max = +2.05 V)
+3.3V: +3.30 V (min = +2.96 V, max = +3.63 V)
+5V: +4.97 V (min = +4.49 V, max = +5.51 V)
+12V: +11.55 V (min = +9.55 V, max = +14.41 V)
-12V: -2.42 V (min = -4.07 V, max = -0.32 V)
-5V: -1.30 V (min = -1.76 V, max = -0.82 V)
fan1: 3901 RPM (min = -1 RPM, div = 2)
fan2: 0 RPM (min = 2636 RPM, div = 8)
fan3: 0 RPM (min = -1 RPM, div = 8)
M/B Temp: +41°C (high = +0°C, hyst = +0°C)
CPU Temp: +51.0°C (high = +100°C, hyst = +90°C)
temp3: -0.5°C (high = +80°C, hyst = +75°C)
vid: +1.750 V (VRM Version 9.0)
alarms:
beep_enable:
Sound alarm enabled

電圧やファンの回転数、CPUの温度がわかる。

微妙にエラーが出ているが、ここでは気にしないことにした。

詳細は下記の方がかなり詳しくやっています。あとハードディスクの温度も。

hwmonモジュール+lm_sensorsとhddtempで温度を取得 - 試験運用中なLinux備忘録

あとは、下記にCPUそれぞれのMAX温度等がのってます。

Processor Electrical Specifications

Check     このエントリーをはてなブックマークに追加