Apacheアクセス統計監視グラフ追加(apachestats)

最終更新日: 2014.02.19

<<トップページ <<新着情報 <<サイト内検索 <<CentOSで自宅サーバー構築 <<Scientific Linuxで自宅サーバー構築

■概要

RRDtool+Cactiのサーバー監視システムにApacheアクセス統計監視グラフを追加する。

サンプル(当サイトのグラフ)※グラフタイトルに「Apache Statistics」と表記されているグラフ


■server-status設定

[root@fedora ~]# vi /etc/httpd/conf/httpd.conf ← Apache設定ファイル編集
#
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
ExtendedStatus On ← ExtendedStatus有効化

#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Change the ".example.com" to match your domain to enable.
#
#<Location /server-status>
#    SetHandler server-status
#    Order deny,allow
#    Deny from all
#    Allow from .example.com
#</Location>
以下を追加
<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 192.168.1.0/24 ← 内部ネットワークアドレスを指定
</Location>

[root@fedora ~]# /etc/rc.d/init.d/httpd reload ← Apache設定反映
httpd を再読み込み中:                                      [  OK  ]

■server-status確認

Webブラウザからhttp://サーバー名/server-status?autoへアクセスして以下のようなページが表示されることを確認。
Total Accesses: 59833
Total kBytes: 739184
CPULoad: .401741
Uptime: 101197
ReqPerSec: .591253
BytesPerSec: 7479.71
BytesPerReq: 12650.6
BusyWorkers: 1
IdleWorkers: 19
Scoreboard: _.___._____W.___.___._.__._

■cactiパッチ※cactiバージョンが0.8.6jの場合のみ

cacti-0.8.6jでグラフが一部表示されない不具合があり、提供されている対処パッチを施行する。
[root@fedora ~]# cd /var/www/cacti/ ← Cactiインストール先ディレクトリへ移動

[root@fedora cacti]# wget http://www.cacti.net/downloads/patches/0.8.6j/thumbnail_graphs_not_working.patch ← パッチをダウンロード

[root@fedora cacti]# patch -p1 -N < thumbnail_graphs_not_working.patch ← パッチを施行
patching file lib/rrd.php

[root@fedora cacti]# rm -f thumbnail_graphs_not_working.patch ← パッチを削除

[root@fedora cacti]# cd ← ホームディレクトリへ戻る

■Apacheアクセス統計監視グラフ追加

(1)Apacheアクセス統計収集スクリプトインストール
[root@fedora ~]# wget http://forums.cacti.net/download/file.php?id=9907 -O ws_apachestats.pl.gz ← Apacheアクセス統計収集スクリプトダウンロード

[root@fedora ~]# gunzip ws_apachestats.pl.gz ← Apacheアクセス統計収集スクリプト解凍

[root@fedora ~]# chmod +x ws_apachestats.pl ← Apacheアクセス統計収集スクリプトへ実行権限付加

[root@fedora ~]# mv ws_apachestats.pl /var/www/cacti/scripts/ ← Apacheアクセス統計収集スクリプトを所定のディレクトリへ移動

(2)Apacheアクセス統計監視グラフ追加※Webブラウザから行う
Cacti用Apacheアクセス統計監視グラフテンプレートをダウンロードする。※IEの場合、リンクを右クリックして「対象をファイルに保存」でダウンロードする

http://サーバー名/cacti/へアクセスしてadminでログインする。

consoleタブ
Import Templates
Import Template from Local Fileでダウンロードしたファイルを選択
save

consoleタブ
Devices⇒Localhost
Host Template・・・Web Server - Apache選択
save
Create Graphs for this Host
Graph Template NameでWebServer - Apache Statistics〜を全てチェック
create
create

■Apacheアクセス統計監視グラフ確認

約10分後graphsタブをクリックしてグラフが表示されることを確認。


■関連コンテンツ




▲このページのトップへ戻る

プライバシーポリシー