muninの監視項目にApacheを追加
2016/11/27
環境
CentOSのバージョン
1 2 |
# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) |
Apacheのバージョン
1 2 |
# httpd -v Server version: Apache/2.4.6 (CentOS) |
必要なモジュールが組み込まれているか確認
1 2 |
# httpd -M | grep status status_module (shared) |
ApacheのプラグインをMuninに追加
Muninはローカルネットワーク領域内のサーバに対し 「server-status」の情報を取得しグラフ化します。
access Apacheウェブサーバのアクセス数
processes Apacheウェブサーバのプロセス数
volume Apacheウェブサーバの転送量
1 2 3 |
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 |
設定変更
Apacheの httpd.confに下記を追記
1 |
ExtendedStatus On |
バーチャルホストの設定を追記する
1 2 3 4 5 6 7 8 9 10 |
#status <VirtualHost *:80> ServerName 127.0.0.1 <Location /server-status> SetHandler server-status Order deny,allow Deny from all allow from 127.0.0.1 </Location> </VirtualHost> |
Apacheの再起動
1 |
# systemctl restart httpd.service |
下記コマンドを実行すると値が取れる
1 2 3 4 |
# /usr/sbin/munin-run apache_processes busy80.value 1 idle80.value 9 free80.value 246 |
しばらくするとApacheのプロセスがグラフに表示されます。