Muninインストールメモ on ubuntu 13.10

リソース監視用サーバをたてるため、muninをインストールした際のメモ。

パッケージインストール

munin - Webインターフェース
munin-node - モニタリングデーモン
munin-plugins-extra - 拡張プラグイン

$sudo apt-get install munin munin-node munin-plugins-extra

公開先変更

デフォルトでは/var/cache/munin/www以下が公開されるようなので、/var/www/html以下に変更

sudo cp -r /var/cache/munin/www /var/www/html/munin

設定ファイルのバックアップ

$sudo cp /etc/munin/munin.conf /etc/munin/munin.backup
$sudo cp /etc/munin/apache.conf / etc/munin/apache.backup

apache用の設定ファイルにリンクを張る

$sudo ln -s /etc/munin/apache.conf /etc/apache2/site-available/munin

munin.confの修正

htmldirをコメントアウトして、公開先のパスに変更。(デフォルトは/var/cache/munin/www)


htmldir /var/www/munin
念のためTLSを無効化

tls disabled

apache.confの修正

/etc/munin/apache.confを開いて、以下を修正する。
エイリアスの指定


Alias /munin /var/www/munin
Directoryを/var/www/munin/に変更
デフォルトではローカルからしかmuninのサイトを参照できないので以下のように修正
以下のように修正しない場合はapacheのエラーログにclient denied by server configurationが吐かれる。

Allow from all
Require all granted

これで接続しようとすると、Forbiddenとなってページが見られない。
apacheのエラーログを見ると、Options FollowSymLinks and SymLinksOwnerMatch are both offといったエラーが出るので、
/etc/munin/apache.confを以下のように修正


Alias /munin /var/www/munin #エイリアスを修正
Options FollowSymLinks #シンボリックリンクの追加

パーミッション・所有者の設定

グラフの更新はmuninのperlスクリプトによって行われる。グラフが書き込みされるディレクトリはchmod g+wしておく。

$sudo chown -R munin:munin /var/www/munin

更新時間の変更

/etc/cron.d/muninを編集する。デフォルトは5分で更新する。間隔が短すぎると、ロック処理が間に合わずにエラーを吐くので注意。