muninのインストール
先日リリースしたサーバを監視するためmuninをインストールします。
muninは他の監視ツールより高機能で導入も簡単とのこと。
今回、監視ツールを初めて使うので他との比較はできませんが。。。
まずは、yumインストールをしたいのでmuninがyumインストールできるEPELリポジトリを追加する。
# rpm -ivh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
※サーバ機は、CENTOS6系なので、上記のrpmファイルにてリポジトリをインストール。
CENTOS5系の場合は、別5系のrpmがある。最初は、間違って5系のrpmでリポジトリを追加してしまいmuninのインストールで失敗していました。。。
一日かかってやっと気が付き、5系のリポジトリをアンインストールして、6系のリポジトリに入れなおしたらうまくいった。
→
epelのリポジトリの確認
# yum list installed | grep epel
epelのリポジトリ削除
# yum erase epel-release.noarch
次は、muninとmunin-nodeをyumインストール
# yum –enablerepo=epel -y install munin munin-node
次はmuninの設定
# vi /etc/munin/munin.conf
以下で監視するサーバの設定をおこなう。「[SampleInfo]」の部分がmuninのTOPページのリンクになる。
# a simple host tree
[SampleInfo]
address 127.0.0.1
use_node_name yes
次は、監視される側の設定。監視されるホスト名を設定する。
また、munin-nodeサーバにアクセスする親サーバのIPアドレスに対して許可設定をする。
# vi /etc/munin/munin-node.conf
# Set this if the client doesn't report the correct hostname when
# telnetting to localhost, port 4949
host_name sample.com
# A list of addresses that are allowed to connect. This must be a
# regular expression, since Net::Server does not understand CIDR-style
# network notation unless the perl module Net::CIDR is installed. You
# may repeat the allow line as many times as you’d like
allow ^116\.80\.16\.202$
次にmuninを再起動する。設定を変更した場合は再起動しないと反映されない。
# /etc/init.d/munin-node restart
アパッチも再起動。
# apachectl -k graceful
ポートの開閉確認。一応、muninで使用しているポートが正しく開かれているか確認。
nmap localhost -p 4949
つきに以下のコマンドで起動設定を確認
# chkconfig –list munin-node
マシン起動時にmunin-nodeも起動するように設定
# chkconfig munin-node on
エラーなどのログは以下から参照する。
# ls /var/log/munin/