5分で導入!リソース監視ツール「munin」

muninとは

PerlとRRDToolで書かれているリソース監視ツール。CPUやメモリ使用状況、ネットワーク状態などをWeb上で確認することができます。

SNMPの知識が必要なMRTGやNagiosなどの監視ツールとは違って簡単に設定できるのが特徴です。動作には監視サーバー「munin」と監視ノードに入れる「munin-node」の二つのプログラムが必要になります。

監視サーバーと監視ノードが同じ時は「munin」と「munin-node」を同じサーバに入れるだけで完了です。

muninのインストール

Debianのaptで一発インストールで完了します。

$ sudo aptitude install munin munin-node
The following NEW packages will be installed:
  defoma{a} fontconfig{a} fontconfig-config{a} gawk{a} libcairo2{a}
  libdate-manip-perl{a} libdatrie1{a} libdbi0{a} libfont-freetype-perl{a}
  libfontconfig1{a} libfontenc1{a} libglib2.0-0{a} libglib2.0-data{a}
  libio-multiplex-perl{a} libipc-shareable-perl{a} liblog-dispatch-perl{a}
  liblog-log4perl-perl{a} libnet-cidr-perl{a} libnet-server-perl{a}
  libnet-snmp-perl{a} libpango1.0-0{a} libpango1.0-common{a}
  libparams-validate-perl{a} libpixman-1-0{a} libpng12-0{a} librrd4{a}
  librrds-perl{a} libthai-data{a} libthai0{a} libxcb-render-util0{a}
  libxcb-render0{a} libxfont1{a} libxft2{a} libxrender1{a}
  libyaml-syck-perl{a} munin munin-common{a} munin-node rrdtool{a}
  shared-mime-info{a} ttf-dejavu{a} ttf-dejavu-core{a} ttf-dejavu-extra{a}
  x-ttcidfont-conf{a} x11-common{a} xfonts-encodings{a} xfonts-utils{a}
0 packages upgraded, 47 newly installed, 0 to remove and 0 not upgraded.
Need to get 17.1 MB of archives. After unpacking 52.9 MB will be used.
Do you want to continue? [Y/n/?] y

必要なパッケージが一緒にぞろぞろとインストールされます。

インストール後にmuninは起動しています。sysv-rc-confで調べてみると、サービス自動起動も勝手に設定してくれていました。

munin-nodeを起動する前にmuninの設定ファイルを変更してhtmlを書き出すディレクトリを指定しておきます。

$ sudo vi /etc/munin/munin.conf
# The next three variables specifies where the location of the RRD
# databases, the HTML output, logs and the lock/pid files.  They all
# must be writable by the user running munin-cron.  They are all
# defaulted to the values you see here.
#
# dbdir /var/lib/munin
# htmldir /var/cache/munin/www
# logdir /var/log/munin
# rundir  /var/run/munin
#
# Where to look for the HTML templates
# tmpldir       /etc/munin/templates
htmldir /var/www/munin ← htmldirで書き出すディレクトリを指定します

$ sudo chmod 707 /var/www/munin ←muninが書き出すディレクトリはmuninユーザーが読み書きできるようにしておかないとエラーとなります

これで設定は完了です。次にmunin-nodeを起動させます。

$ sudo /etc/init.d/munin-node start

あとは5分ほど待ってhtmlが書き出されているのを確認したら終了です。

muninを使うと、驚くほど簡単にサーバーのリソース監視ができます。

Munin – Trac

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA