ともやんぶろぐ

平凡な大学生の研究だったりプログラミングだったり車だったり適当な話しの日記

lm_sensorsとmuninで温度取ったる

こんにちは。
所持金ないのにカードで車のパーツ買ったともやんです☆どうしよう.....

今日は、前回の記事で書いたmuninに関して引き続きやっていきます!
muninはデフォルトではcpuの温度等取れないので、lm_sensorsというパッケージを入れてmuninと連携させますー。
lm_sensorsは、linux系でマザーボードの温度センサの値をモニタリングするツールです。
しかしマザボの種類によりモニタリング出来るものと出来ないもの、カーネルモジュールをロードすれば出来るもの、どうしても出来ないものに分かれますのでご注意を。


lm_sensorsは当然のことながらmunin-node側のマシンにインストールします。

apt-get install lm-sensors #CentOS系では"lm_sensors"
/usr/sbin/sensor_detect #使えるセンサーを探す

-----------
Some south bridges, CPUs or memory controllers contain embedded sensors.
Do you want to scan for them? This is totally safe. (YES/no): yes
Silicon Integrated Systems SIS5595...                       No
VIA VT82C686 Integrated Sensors...                          No
VIA VT8231 Integrated Sensors...                            No
AMD K8 thermal sensors...                                   No
AMD Family 10h thermal sensors...                           No
AMD Family 11h thermal sensors...                           No
AMD Family 12h and 14h thermal sensors...                   No
AMD Family 15h thermal sensors...                           No
AMD Family 15h power sensors...                             No
Intel digital thermal sensor...                             No
Intel AMB FB-DIMM thermal sensor...                         No
VIA C7 thermal sensor...                                    No
VIA Nano thermal sensor...                                  No #使えるセンサーとかが出てくる

------------

けっこう使えないのばっかりですね...w


カーネルモジュールをロードすれば使えるようになるものは下記のように出てきます。

To load everything that is needed, add this to /etc/modules:
#----cut here----
# Chip drivers
coretemp
it87
#----cut here----
If you have some drivers built into your kernel, the list above will
contain too many modules. Skip the appropriate ones!

sensors_detectを実行した時に自動で設定してくれることもあります。
試しに/etc/modulesを覗いて見ると、

# Generated by sensors-detect on Tue Oct 22 13:43:43 2013
# Chip drivers
coretemp
it87

ばっちりやってくれてました。

次に/etc/munin/plugins/の下にlm_sensorsのプラグインを追加しましょう。

ln -s /usr/share/plugins/sensors_ /etc/munin/plugins/sensor_temp

/etc/munin/plugin-conf.d/munin-nodeに下記を追加して終わりですー

[sensors_*]
user root

http://監視サーバのIP/muninにアクセスするとsensorという項目が増えてるはずです!
rebootも忘れずに!!