muninのプラグインでapache関連のグラフが表示されない件

muninをインストールしたときに、プラグインapache関連がインストールされていなかったので(他のサーバにはちゃんとインストールされていたのに)、手動でインストールしました。

$ sudo ln -s /usr/share/munin/plugins/apache_accesses /etc/munin/plugins/apache_accesses
$ sudo ln -s /usr/share/munin/plugins/apache_processes /etc/munin/plugins/apache_processes
$ sudo ln -s /usr/share/munin/plugins/apache_volume /etc/munin/plugins/apache_volume

が、これがグラフに数値が表示されない(-_-〆)。

プラグインを単体で実行したら、

$ sudo /etc/munin/plugins/munin-run apache_accesses
accesses80.value U

または、

$ ./etc/munin/plugins/apache_accesses
accesses80.value U

と返ってきました。本来なら、

$ sudo /etc/munin/plugins/munin-run apache_accesses
accesses80.value 16262805

みたいになんか数値が表示されるはず(他のサーバにセットしてあるので試してみました)。Uって、なにか、unなんとかのUだよねきっと。

解決方法をググってみました。
https://bugs.launchpad.net/ubuntu/+source/munin/+bug/231706
に、同じ質問をしている人がいて、解決したっぽい。

テストしてみました。

$ munin-run apache_accesses auto
no (no apache server-status or ExtendedStatus missing on ports 80)

http://www.oro.co.jp/web/creator/system/cat68/munin-1.html

より、

1.Apache の場合

Apache を監視するプラグインは、実は Apache の mod_status モジュールにアクセスし、結果を返す仕組みになっています。
Apache をインストールしたときに、この mod_status が組み込まれていなかったり、組み込まれていてもアクセスが拒否されていたり、Munin プラグインが期待する情報を返していないと、munin-node が値を返せない状態になります。

Apache の設定を確認して、1)mod_status モジュールが組み込まれていること、2)localhost(127.0.0.1)から /server-status へのアクセスを許可していること、3)ExtendedStatus ディレクティブが On に設定されていること、を確認してみてください。

どれもやってなかったー\(o_o)/。

https://bugs.launchpad.net/ubuntu/+source/munin/+bug/231706の解決方法を頼りに設定。

You probably need something like this in your apache2.conf:

<IfModule mod_status.c>
    ExtendedStatus On
    <Location /server-status>
        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
    </Location>
</IfModule>

とあったので、/etc/httpd/conf.dの中にあるmunin.confを以下に修正。

<Location /munin>
   Order deny,allow
   Deny from all
   #Allow from 127.0.0.1 192.168.0
    Allow from all
</Location>

<IfModule mod_status.c>
    ExtendedStatus On
    <Location /server-status>
        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
    </Location>
</IfModule>

で、

$ sudo /etc/init.d/httpd reload
$ sudo /etc/rc.d/init.d/munin-node restart
$ sudo /etc/rc.d/rc3.d/S10munin-node restart

してみました。そうしたらちゃんとグラフが表示されるようになりました!