
muninは非常に簡単でサーバの状態を確認できるツールとなっています。
インストールと設定
yum install munin-apache.noarch munin-node munin-common vlgothic-fonts vlgothic-p-fonts
# fonts は文字化けの対応のためのインストール
インストールされるバージョンは、2.0.43となります。
muninはApacheを経由して見るので、事前に httpd のインストールが必要です。
Apacheの監視を入れる(任意)
Apacheの status を取得するため、server-status を有効化します。
vi /etc/httpd/conf.d/server-status.conf
<Location "/server-status">
SetHandler server-status
Require host localhost
</Location>
MySQLを監視する設定を入れる(任意)
PHPMyAdmin に root でログインし、munin 用のユーザを作成します。
munin 用のユーザは、管理権限にすべてチェックを入れておくと良いでしょう。
munin のコンフィグファイルを調整します。
vi /etc/munin/plugin-conf.d/00-default
[mysql*]
env.mysqlopts -umunin --password=[設定したパスワード]
env.mysqlconnection DBI:mysql:mysql;host=localhost;port=3306
env.mysqluser munin
env.mysqlpassword [設定したパスワード]
#env.mysqlopts -u someuser
一部抜粋ですが[mysql*]の部分のみ変更を行います。
[設定したパスワード]の[ ] は不要です。
設定の確認
munin-node-configure -suggest というコマンドを実行します。
munin-node-configure -suggest
mysql 部分が yes になっているのを確認してください。
(mysql の監視が不要の場合は no のままで問題ありません)
設定からプラグインを反映する
munin-node-configure から簡単に反映することが出来ます。
munin-node-configure -shell | sh
muninの起動と自動実行設定
munin の自動起動の設定をします。
ついでに httpd も起動します。
systemctl enable munin-node
systemctl enable httpd
systemctl start munin-node
systemctl start httpd
munin用のVH(今回の場合は共有VH)を作成
/etc/httpd/conf.d/munin-vhost.conf を作成します。
vi /etc/httpd/conf.d/munin-vhost.conf
<VirtualHost *:80>
ServerName 192.168.xxx.2
DocumentRoot "/var/www/html"
ScriptAlias /munin-cgi/munin-cgi-graph /var/www/html/munin/cgi/munin-cgi-graph
<Directory />
Options +FollowSymLinks -Indexes
AllowOverride All
Allow from 192.168.
Allow from 127.0.0.1
deny from all
</Directory>
</VirtualHost>
IPアドレス直でアクセスがあった場合、上記のVirtualHostを表示するようにします。
セキュリティのため、一応ローカルからしかアクセスできないようにも設定します。
Apacheへ設定の反映
systemctl restart httpd
Basic認証が出る場合
muninのデフォルトではbasic認証が出るようになっています。
これを回避するには、 /var/www/html/munin/.htaccess の
以下をコメントアウトします。
または適切なBasic認証を設定します。
AuthName “Munin”
AuthType Basic
require valid-user
ブラウザでアクセス
http://[サーバIP]/munin/ でmunin の画面が表示されるようになります。
強制的にグラフをアップデート
グラフは5分毎に更新されますが、テストですぐに更新したい場合は下記のコマンドを打つと更新されます。
su - munin --shell=/usr/bin/munin-cron
実際の表示

munin.conf munin-node.conf を書き換えることにより、localhost の部分を変更できますが今回はこのままにしています。
上記の例では、ACPIの温度(CPU)を自動でとってきてグラフ化してくれています。