http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/i386/repoview/epel-release.html より EPEL リポジトリパッケージを取得.
% sudo rpm -ivh src/epel-release-6-8.noarch.rpm % sudo vi /etc/yum.repos.d/epel.repo
を編集し,最初の
enabled=1
を
enabled=0
としておく.
% sudo yum --enablerepo=epel install munin
山の用にたくさんのパッケージが導入される.
LoadModule auth_basic_module modules/mod_auth_basic.so LoadModule authn_file_module modules/mod_authn_file.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_user_module modules/mod_authz_user.so
# htpasswd /etc/munin/munin-htpasswd munin New password: Re-type new password: Adding password for user munin
# /etc/init.d/httpd configtest # /etc/init.d/httpd restart
http://X.X.X.X/munin
/etc/munin/munin.conf を編集
[グループ名;] node_order node01 node02 node03 ... [グループ名;ノード名] address 対象アドレス use_nodename yes
/etc/munin/munin.conf の監視ノードの設定をしているブロックより前 (グローバルの設定)に以下を書いておく.
graph_data_size huge
cron で動いているので,再起動の必要なし.
% sudo yum --enablerepo=epel install munin-node
ノードをインストールしたマシンでは,
# chkconfig --add munin-node # chkconfig munin-node on # /etc/init.d/munin-node start
allow ^192\.168\.1\.1$ <---サーバのドレス
/etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 4949 -j ACCEPT
/etc/munin/plugins にある不要なシンボリックリンクを削除する.
# cd /etc/munin/plugins # rm postfix_mail* # rm selinux_avcstat # rm fw_* # rm ntp* # /etc/init.d/munin-node restart
/etc/httpd/conf/httpd.conf
# LoadModule auth_basic_module modules/mod_auth_basic.so # LoadModule authn_file_module modules/mod_authn_file.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule status_module modules/mod_status.so ExtendedStatus On <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from 127.0.0.1 </Location>
# cd /etc/munin/plugins # ln -s /usr/share/munin/plugins/apache_accesses . # ln -s /usr/share/munin/plugins/apache_processes . # ln -s /usr/share/munin/plugins/apache_volume . # /etc/init.d/munin-node restart
MySQL ユーザ追加
# mysql -u root -p mysql> CREATE DATABASE munin; mysql> GRANT SELECT ON munin.* TO munin@localhost IDENTIFIED BY 'password'; mysql> FLUSH PRIVILEGES;
# vi /etc/munin/plugin-conf.d/munin-node
以下の 2行を追加
[mysql*] env.mysqlopts -u munin --password=password
設定をテスト
# cd /etc/munin/plugins # ln -s /usr/share/munin/plugins/mysql_bytes . # ln -s /usr/share/munin/plugins/mysql_queries . # ln -s /usr/share/munin/plugins/mysql_slowqueries . # ln -s /usr/share/munin/plugins/mysql_threads . # cd /etc/munin/plugins # /usr/sbin/munin-run mysql_bytes recv.value 22650065 sent.value 104515744 # /usr/sbin/munin-run mysql_queries delete.value 741 insert.value 1317 replace.value 0 select.value 60604 update.value 2829 cache_hits.value 0 # /usr/sbin/munin-run mysql_slowqueries queries.value 0 # /usr/sbin/munin-run mysql_threads threads.value 1 # /etc/init.d/munin-node restart