自宅サーバー構築メモ(その6) muninでサーバー監視する
rpmforgeリポジトリからrrdtoolをインストール
# yum install --enablerepo=rpmforge rrdtool rrdtool-devel
~省略~
Installed:
rrdtool.x86_64 0:1.3.8-2.el5.rf rrdtool-devel.x86_64 0:1.3.8-2.el5.rf
Dependency Installed:
chkfontpath.x86_64 0:1.10.1-1.1 libFS.x86_64 0:1.0.0-3.1 libXfont.x86_64 0:1.2.2-1.0.3.el5_1
libfontenc.x86_64 0:1.0.2-2.2.el5 perl-rrdtool.x86_64 0:1.3.8-2.el5.rf ruby.x86_64 0:1.8.5-5.el5_4.8
ruby-libs.x86_64 0:1.8.5-5.el5_4.8 ttmkfdir.x86_64 0:3.0.9-23.el5 xorg-x11-font-utils.x86_64 1:7.1-2
xorg-x11-fonts-Type1.noarch 0:7.1-2.1.el5 xorg-x11-xfs.x86_64 1:1.0.2-4
Complete!
epelリポジトリからmuninとmunin-nodeをインストール
# yum --enablerepo=epel install munin munin-node
~省略~
Installed:
munin.noarch 0:1.4.3-2.el5 munin-node.noarch 0:1.4.3-2.el5
Dependency Installed:
munin-common.noarch 0:1.4.3-2.el5 perl-DBI.x86_64 0:1.52-2.el5 perl-IPC-Shareable.noarch 0:0.60-3.el5
perl-Log-Dispatch.noarch 0:2.20-1.el5 perl-Log-Dispatch-FileRotate.noarch 0:1.16-1.el5 perl-Log-Log4perl.noarch 0:1.13-2.el5
perl-MIME-Lite.noarch 0:3.01-5.el5 perl-Mail-Sender.noarch 0:0.8.13-2.el5.1 perl-Mail-Sendmail.noarch 0:0.79-9.el5.1
perl-MailTools.noarch 0:1.77-1.el5.centos perl-Params-Validate.x86_64 0:0.88-3.el5 perl-TimeDate.noarch 1:1.16-5.el5
perl-XML-DOM.noarch 0:1.44-2.el5 perl-XML-Parser.x86_64 0:2.34-6.1.2.2.1 perl-XML-RegExp.noarch 0:0.03-2.el5
Complete!
設定ファイルの場所
同一サーバーにmuninとmunin-nodeをインストールしたので両方の設定ファイルがあります。
今回は設定ファイルは編集せず、デフォルトのままで動かします。
# ls -laF /etc/munin
total 56
drwxr-xr-x 5 root root 4096 May 3 18:50 ./
drwxr-xr-x 82 root root 4096 May 3 18:50 ../
-rw-r--r-- 1 root root 3893 Jan 25 08:11 munin.conf
-rw-r--r-- 1 root root 1239 Jan 25 08:11 munin-node.conf
drwxr-xr-x 2 root root 4096 May 3 18:50 plugin-conf.d/
drwxr-xr-x 2 root root 4096 May 3 18:50 plugins/
drwxr-xr-x 3 root root 4096 May 3 18:50 templates/
データファイルの場所
muninがmunin-nodeから集めた情報がここに集積されます。
# ls -laF /var/lib/munin
total 56
drwxr-xr-x 3 munin munin 4096 May 3 19:00 ./
drwxr-xr-x 20 root root 4096 May 3 18:59 ../
-rw-r--r-- 1 munin munin 14 May 3 19:00 datafile
-rw-r--r-- 1 munin munin 14 May 3 19:00 limits
-rw-r--r-- 1 munin munin 14 May 3 19:00 munin-graph.stats
-rw-r--r-- 1 munin munin 9 May 3 19:00 munin-update.stats
drwxr-xr-x 2 munin munin 4096 Jan 25 08:11 plugin-state/
コンテンツファイルの場所
muninを稼動させた直後にindex.htmlがありませんが、時間が経つと(5分?)作成されます。
# ls -laF /var/www/html/munin
total 172
drwxr-xr-x 4 munin munin 4096 May 3 19:00 ./
drwxr-xr-x 3 root root 4096 May 3 18:59 ../
drwxr-xr-x 2 munin munin 4096 May 3 18:59 cgi/
-rw-r--r-- 1 munin munin 2555 May 3 19:00 definitions.html
-rw-r--r-- 1 munin munin 2046 May 3 19:00 favicon.ico
-rw-r--r-- 1 munin munin 864 Jan 25 08:11 .htaccess
-rw-r--r-- 1 munin munin 1794 May 3 19:00 logo-h.png
-rw-r--r-- 1 munin munin 473 May 3 19:00 logo.png
-rw-r--r-- 1 munin munin 1700 Dec 30 21:55 munin-comparison-day.tmpl
-rw-r--r-- 1 munin munin 1705 Dec 30 21:55 munin-comparison-month.tmpl
-rw-r--r-- 1 munin munin 1702 Dec 30 21:55 munin-comparison-week.tmpl
-rw-r--r-- 1 munin munin 1702 Dec 30 21:55 munin-comparison-year.tmpl
-rw-r--r-- 1 munin munin 3461 Dec 30 21:55 munin-domainview.tmpl
-rw-r--r-- 1 munin munin 849 Dec 30 21:55 munin-htaccess.in
-rw-r--r-- 1 munin munin 2368 Dec 30 21:55 munin-nodeview.tmpl
-rw-r--r-- 1 munin munin 6401 Dec 30 21:55 munin-overview.tmpl
-rw-r--r-- 1 munin munin 5912 Dec 30 21:55 munin-serviceview.tmpl
drwxr-xr-x 2 munin munin 4096 May 3 18:59 partial/
-rw-r--r-- 1 munin munin 3619 Dec 30 21:55 style-1.2.css
-rw-r--r-- 1 munin munin 5351 May 3 19:00 style.css
smartctl用のプラグインを有効にする
# cd /etc/munin/plugins/
# ln -s /usr/share/munin/plugins/hddtemp_smartctl hddtemp_smartctl
smartctl用の設定ファイルを作成する
# vi /etc/munin/plugin-conf.d/hddtemp_smartctl
hddtemp_smartctlファイルに以下の内容を記述する
[hddtemp_smartctl]
user root
env.drives sda sdb sdc
env.args_sda --all -d ata
env.args_sdb --all -d ata
env.args_sdc --all -d ata
ipmi用のプラグインの設定をmunin-nodeファイルに追記する
# vi /etc/munin/plugin-conf.d/munin-node
munin-nodeファイルに以下の内容を記述する
[ipmi*]
user root
timeout 20
munin-nodeの起動スクリプトを有効にし、サービスを開始する。
# chkconfig --list munin-node
munin-node 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# chkconfig munin-node on
# service munin-node start
Starting Munin Node: [ OK ]
このようなグラフが得られます。