Fedora18のMunin2にhttpdの監視を追加する手順メモ

Muninをインストール、設定してみましたので、メモ。

環境

  • Fedora18
  • Apache 2.4.3
  • Munin 2.0
uname -r
3.7.6-201.fc18.x86_64

状態を確認

  • muninにはapache監視プラグインが付属していますので、munin-node-configureコマンドで確認します。
# munin-node-configure --suggest
Plugin                     | Used | Suggestions
------                     | ---- | -----------
acpi                       | no   | no [cannot read []
amavis                     | no   | no
apache_accesses            | no   | no [apache server-status not found. check if mod_status is enabled]
apache_processes           | no   | no [apache server-status not found. check if mod_status is enabled]
apache_volume              | no   | no [apache server-status not found. check if mod_status is enabled]
(snip)
  • Plugin→プラグイン自体は存在しています。(実体は/usr/share/munin/plugins/)
  • Used→使用する設定になっていません。
  • Suggestions→問題があるので、使えません。
  • server-statusが無いので使えないといっています。mod_statusを有効にすれば良いようです。

mod_statusを有効にする

  • httpd用のコンフィグファイルを作成します。
  • mod_statusを有効にし、/server-status パスでアクセス可能にします。ただし、localhostからのみアクセス許可します。(外部公開しては問題ですから)
  • 余談ですが、httpd2.4では、「order deny,allow」の記述は「Require~」に変更になっています。

/etc/httpd/conf.d/status.conf

<IfModule mod_status.c>
    ExtendedStatus On
    <Location /server-status>
        SetHandler server-status
        Require host localhost
    </Location>
</IfModule>
  • httpdを再起動します。
systemctl restart httpd.service

munin状態を再確認

munin-node-configure --suggest
Plugin                     | Used | Suggestions
------                     | ---- | -----------
acpi                       | no   | no [cannot read []
amavis                     | no   | no
apache_accesses            | no   | yes
apache_processes           | no   | yes
apache_volume              | no   | yes
(snip)
  • Suggestions列がyesに変更になっています。

muninに設定を追加

munin-node-configure --shell
ln -s '/usr/share/munin/plugins/apache_accesses' '/etc/munin/plugins/apache_accesses'
ln -s '/usr/share/munin/plugins/apache_processes' '/etc/munin/plugins/apache_processes'
ln -s '/usr/share/munin/plugins/apache_volume' '/etc/munin/plugins/apache_volume'
# The following plugins caused errors:
# ntp_states:
(snip)

lnコマンド部分を実行します。

munin-nodeを再起動

systemctl restart munin-node.service


最終的にどうなったかmunin状態を確認

munin-node-configure --suggest
Plugin                     | Used | Suggestions
------                     | ---- | -----------
acpi                       | no   | no [cannot read []
amavis                     | no   | no
apache_accesses            | yes  | yes
apache_processes           | yes  | yes
apache_volume              | yes  | yes
(snip)
  • Used列もyesに変更になりました。

facebook slideshare rubygems github qiita