CentOS 6.5 で Munin を使ってみる

nginxのインストールは完了したので、1台にMunin-serverとMunin-nodeをインストールしてモニタリングする環境を構築する。

$ uname -srv
Linux 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013

$ cat /etc/redhat-release
CentOS release 6.5 (Final)
% yum install http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ yum info --enablerepo=epel munin
Available Packages
Name        : munin
Arch        : noarch
Version     : 2.0.21
Release     : 1.el6
Size        : 195 k
Repo        : epel
Summary     : Network-wide graphing framework (grapher/gatherer)
URL         : http://munin-monitoring.org/
License     : GPLv2
Description : Munin is a highly flexible and powerful solution used to create
            : graphs of virtually everything imaginable throughout your network,
            : while still maintaining a rattling ease of installation and
            : configuration.
            :
            : This package contains the grapher/gatherer. You will only need one
            : instance of it in your network. It will periodically poll all the
            : nodes in your network it's aware of for data, which it in turn
            : will use to create graphs and HTML pages, suitable for viewing
            : with your graphical web browser of choice.
            :
            : Munin is written in Perl, and relies heavily on Tobi Oetiker's
            : excellent RRDtool.
            :
            : Creaete a munin web user after installing:
            : htpasswd -bc /etc/munin/munin-htpasswd MUNIN_WEB_USER PASSWORD
% yum install --enablerepo=epel munin munin-node munin-common munin-nginx

Munin 設定

$ cd /etc/munin
% cp munin.conf munin.conf.org
% cp munin-node.conf munin-node.conf.org

munin.conf(5)を眺めてみると以下のように書かれていた。

graph_strategy value
           Deprecated. (Graphs are now always drawn via CGI.)

graph_strategyは廃止でグラフは常にCGIで描かれているようだ。munin.conf(5)にはhtml_strategyについての記述はなかったが、munin.confにはhtml_strategyが設定されていた。なんでなのかはよくわからない。

$ diff -u munin.conf.org munin.conf
--- munin.conf.org      2014-06-16 15:57:47.764255564 +0000
+++ munin.conf  2014-06-17 01:30:28.002698093 +0000
@@ -5,10 +5,10 @@
 # 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/www/html/munin
-#logdir /var/log/munin
-#rundir  /var/run/munin
+dbdir  /var/lib/munin
+htmldir /var/www/html/munin
+logdir /var/log/munin
+rundir  /var/run/munin

 # Where to look for the HTML templates
 #
@@ -37,7 +37,7 @@
 # Since 2.0, munin-graph has been rewritten to use the cgi code.
 # It is single threaded *by design* now.
 #
-graph_strategy cron
+graph_strategy cgi

 # munin-cgi-graph is invoked by the web server up to very many times at the
 # same time.  This is not optimal since it results in high CPU and memory
@@ -66,7 +66,7 @@
 # - moving to CGI for HTML means you cannot have graph generated by cron.
 # - cgi html has some bugs, mostly you still have to launch munin-html by hand
 #
-html_strategy cron
+html_strategy cgi

 # munin-update runs in parallel.
 #

nginx 設定

必要のないconfがincludeされないようにリネームしておく。

$ cd /etc/nginx/conf.d
$ ls
default.conf  example_ssl.conf  munin.conf

% cp munin.conf munin.conf.orig
% mv default.conf default.conf.orig
% mv exsample_ssl.conf exsample_ssl.conf.orig

Munin 起動

% service munin-fcgi-graph start
% service munin-fcgi-html start
% service munin-node  start
% service nginx start

% chkconfig munin-fcgi-graph on
% chkconfig munin-fcgi-html on
% chkconfig munin-node on
% chkconfig nginx on