Personal tools
You are here: Home サーバ設定 munin muninインストール
Document Actions

muninインストール

by tamohiko last modified 2008-07-04 12:00

munin-serverとmunin-nodeのインストール手順です。

検証環境

OS:CentOS 5.1

前提条件

muninを動作させるには、収集サーバ側にはapacheがインストールされていることが条件となります。
エージェントのみ動作させる場合は、apacheはいりません。

muninとは?

MRTGよりも比較的に簡単にインストールや設定ができて、 ネットワークトラヒックやシステムの状態などを監視することができるアプリケーションです。

実際の画面はこんな感じです。

munin画面
munin_index munin_index

muninインストール

muninはmuninとmunin-nodeにわかれています。 今回は自分自身を監視するので、両方インストールします。

munin-serverインストール

まずは、munin-serverをインストールします。
インストールはいつものようにお手軽yumでインストールを行います。

yumでインストールを行うと、muninインストールに必要な 他のアプリケーションも併せてインストールしてくれるので 非常に楽チンです。

[root@www ~]# yum -y install munin
Loading "installonlyn" plugin
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
dag                       100% |=========================| 1.1 kB    00:00     
base                      100% |=========================| 1.1 kB    00:00     
updates                                                          972 B 00:00 
addons                    100% |=========================|  951 B    00:00     
extras                    100% |=========================| 1.1 kB    00:00     
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files

############   中略   ###############

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size 
=============================================================================
Installing:
 munin                   noarch     1.2.5-1.el5.rf   dag               128 k
Installing for dependencies:
 perl-Crypt-DES          i386       2.05-3.2.el5.rf  dag                37 k
 perl-DateManip          noarch     5.44-1.2.1       base              144 k
 perl-HTML-Template      noarch     2.9-1.el5.rf     dag                62 k
 perl-Net-SNMP           noarch     5.2.0-1.2.el5.rf  dag                96 k
 perl-Net-Server         noarch     0.97-1.el5.rf    dag               157 k
 perl-rrdtool            i386       1.2.23-1.el5.rf  dag                49 k
 rrdtool                 i386       1.2.23-1.el5.rf  dag               933 k

Transaction Summary
=============================================================================
Install      8 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         

Total download size: 1.6 M
Downloading Packages:
(1/8): perl-rrdtool-1.2.2 100% |=========================|  49 kB    00:00     
(2/8): perl-DateManip-5.4 100% |=========================| 144 kB    00:00     
(3/8): perl-HTML-Template 100% |=========================|  62 kB    00:00     
(4/8): perl-Net-Server-0. 100% |=========================| 157 kB    00:01     
(5/8): perl-Crypt-DES-2.0 100% |=========================|  37 kB    00:00     
(6/8): rrdtool-1.2.23-1.e 100% |=========================| 933 kB    00:06     
(7/8): munin-1.2.5-1.el5. 100% |=========================| 128 kB    00:00     
(8/8): perl-Net-SNMP-5.2. 100% |=========================|  96 kB    00:00     
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: perl-Crypt-DES               ######################### [1/8] 
  Installing: perl-Net-SNMP                ######################### [2/8] 
  Installing: perl-Net-Server              ######################### [3/8] 
  Installing: perl-HTML-Template           ######################### [4/8] 
  Installing: perl-DateManip               ######################### [5/8] 
  Installing: rrdtool                      ######################### [6/8] 
  Installing: perl-rrdtool                 ######################### [7/8] 
  Installing: munin                        ######################### [8/8] 

Installed: munin.noarch 0:1.2.5-1.el5.rf
Dependency Installed: perl-Crypt-DES.i386 0:2.05-3.2.el5.rf perl-DateManip.noarch 0:5.44-1.2.1 perl-HTML-Template.noarch 0:2.9-1.el5.rf perl-Net-SNMP.noarch 0:5.2.0-1.2.el5.rf perl-Net-Server.noarch 0:0.97-1.el5.rf perl-rrdtool.i386 0:1.2.23-1.el5.rf rrdtool.i386 0:1.2.23-1.el5.rf
Complete!

わたしの環境では全部で8つのパッケージがインストールされました :-p

muni-nodeインストール

munin-serverのインストールが終わったら、 今度はmunin-serverのエージェントで監視ターゲットのデータを収集を行う「muni-node」のインストールを行います

こちらもyumでサクッとインストールします。

[root@www ~]# yum -y install munin-node
Loading "installonlyn" plugin
Loading "fastestmirror" plugin

##########    中略     ##############

Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: munin-node                   ######################### [1/1] 

Installed: munin-node.noarch 0:1.2.5-1.el5.rf
Complete!

yumをつかえばインストールは特に問題なく完了できると思います。

munin-serverの設定

インストールが完了しましたら、まずはserverの設定を行います。
設定ファイルは「/etc/munin/」ディレクトリにあります。

[root@www ~]# cd /etc/munin/
[root@www munin]# ls -la
合計 44
drwxr-xr-x   5 root root  4096  6月  2 16:10 .
drwxr-xr-x 115 root root 12288  6月  2 16:08 ..
-rw-r--r--   1 root root   786  4月 29  2007 munin-node.conf
-rw-r--r--   1 root root  2661  4月 29  2007 munin.conf
drwxr-xr-x   2 root root  4096  6月  2 16:10 plugin-conf.d
drwxr-xr-x   2 root root  4096  6月  2 16:10 plugins
-rw-r--r--   1 root root   697 10月 17  2006 plugins.conf
drwxr-xr-x   2 root root  4096  6月  2 16:08 templates
munin.conf設定

「munin.conf」がmuni-serverの設定ファイルとなります。

munin.conf 設定項目
  • htmlデータ格納ディレクトリの設定
  • 監視を行うノード情報の登録
# cd /etc/munin
# cp -p munin.conf munin.conf_yyyymmdd
# vi munin.conf
htmlデータ格納
変更前
htmldir /var/www/html/munin

変更後
htmldir /var/www/munin
munin-serverの起動

munin-serverがインストールされると自動的にcronに登録されます。
source等からインストールを行った場合は、自分で設定する必要があります。

cron設定内容
]# cat /etc/cron.d/munin 
#
# cron-jobs for munin
#

MAILTO=root

*/5 * * * *     munin test -x /usr/bin/munin-cron && /usr/bin/munin-cron

munin-node設定

munin-node.conf設定

munin-node設定ファイルは/etc/munin/munin-node.confとなります。

munin-node.conf 設定項目

munin-nodeで必要は設定は以下のとおりとなります。

  • 表示ホスト名
  • munin-serverのアドレス
munin-node.conf編集
# cd /etc/munin/
# cp -p munin-node.conf munin-node.conf_yyyymmdd
# vi munin-node.conf
編集箇所
ホスト名設定
変更前
#host_name lisse.leuven.wieers.com

変更後
host_name www.example.jp


muninサーバのアドレス設定
変更前
allow ^127\.0\.0\.1$

変更後
allow muninサーバを設定します。
munin-node設定反映
[root@www munin]# /etc/init.d/munin-node start
Starting Munin Node:                                       [  OK  ]
munin-node自動起動設定
[root@www]# chkconfig munin-node on
[root@www]# chkconfig --list munin-node
munin-node      0:off   1:off   2:on    3:on    4:on    5:on    6:off

以上で、munin-nodeの設定は完了となります

apache設定

yumでインストールすると、apache用の設定ファイルである 「/etc/httpd/conf.d/munin.conf」 が自動的に作成されます

わたしの環境では/etc/httpd/conf.d/munin.confは以下のようになっています。
SSLを使わないのであればコメント部分はそのままにしておいてください。

# For SSL-servers
ScriptAlias /munin/cgi/ /var/www/munin/cgi/
#
#   Options ExecCGI
#   SSLRequireSSL
#   order deny,allow
#   deny from all
#   AuthType Basic
#   AuthUserFile /site/cfg/passwd
#   AuthGroupFile /site/cfg/group
#   AuthName "munin"
#   require group munin
#   Satisfy Any
#
#
Alias /munin/ /var/www/munin/
#
#   Options None
#   SSLRequireSSL
#   order deny,allow
#   deny from all
#   AuthType Basic
#   AuthUserFile /site/cfg/passwd
#   AuthGroupFile /site/cfg/group
#   AuthName "munin"
#   require group munin
#   Satisfy Any
#

ソース等でインストールした場合は、このファイルがないと思います。
Aliasの設定等を追加したい場合は、適宜httpd.confに追記するなりしてください。

/etc/init.d/httpd reloadで反映させます。

動作確認

webブラウザで「http://[サーバのIP]/munin/」でアクセスしてください。

munin画面
munin_index munin_index
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: