【CentOS】apache同時接続数を確認するには
CentOS6 の環境ですが、apacheの接続数を確認する必要があったので調べましたので
そちらのやり方を書かせていただきます。
結論を言うと下記で調べることができます。
=========================================================
Apache Server Status for localhost
Server Version: Apache/******** (Unix) DAV/2 PHP/******** mod_ssl/********
OpenSSL/1.0.1e-fips
Server Built: Mar 22 2017 06:52:55
--------------------------------------------------------------------------
Current Time: Sunday, ******** JST
Restart Time: Sunday, ******** JST
Parent Server Generation: 1
Server uptime: 5 hours 24 minutes 56 seconds
1 requests currently being processed, 39 idle workers
_.W____..__.__.____________.____._.___..._..__._._.._...._.._...
_..........................................._...................
................................................................
................................................................
................................................................
................................................................
................................................................
................................................................
=========================================================
なので該当の部分だけ取得すると下記のようにgrepします。
$ apachectl status | grep requests
◆エラー対応①
$ apachectl status
The 'links' package is required for this functionality.
上記エラーの場合下記をインストールします。
# yum -y install elinks
◆エラー対応②
実行時に下記エラーが出た場合
ELinks: SSL error
コマンドは下記シェルスクリプトになっているのでこちらを修正します。
私の場合80ポートではアクセスできなかったため、httpsでアクセスするようにしました。
# vi /usr/sbin/apachectl
< STATUSURL="https://localhost/server-status"
---
> STATUSURL="http://localhost:80/server-status"
又はhttpd.confでアクセス権限が付与されているか確認してください。
=========================================================
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from localhost
</Location>
=========================================================