mod_status: Provides information of server activity and
performance. Apache’s mod_status shows current information of web server. mod_status
is used to get a current view of Apache key parameters and a snapshot of all
its request handlers.
Before starting to monitor an apache web server, we must have a web server. For this, you must visit:
Before starting to monitor an apache web server, we must have a web server. For this, you must visit:
I have following Testing Environment:
- Operating System: RedHat 6.0
- IP Address: 192.168.10.139
- Hostname: rhpanacia.example.com
- Site: http://www.site1.example.com
- DocumentRoot: /var/www/rhpanacia
# vi /etc/httpd/conf/httpd.conf
<<Uncomment line no. 178>>
LoadModule status_module modules/mod_status.so
Step2: Configure
mod_status:
<<Uncomment Lines for Location directive from line no 921-926>>
<Location /server-status>
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from .example.com
</Location>
Order deny,allow
Deny from all
Allow from .example.com
</Location>
This is the default configuration for default Apache web
site, having only one site. If you are using multiple sites then you must
define these directive in your VirtualHost directive. Like:
<VirtualHost *:80>
ServerAdmin root@rhpanacia.example.com
DocumentRoot /var/www/rhpanacia
ServerName site1.example.com
ErrorLog /var/log/rhpanacia/rhpanacia.example.com-error_log
CustomLog /var/log/rhpanacia/rhpanacia.example.com-access_log common
ServerAdmin root@rhpanacia.example.com
DocumentRoot /var/www/rhpanacia
ServerName site1.example.com
ErrorLog /var/log/rhpanacia/rhpanacia.example.com-error_log
CustomLog /var/log/rhpanacia/rhpanacia.example.com-access_log common
<Location /server-status>SetHandler server-status
Order allow,deny
Deny from all
Allow from *.example.com
</Location>
Order allow,deny
Deny from all
Allow from *.example.com
</Location>
</VirtualHost>
Step3: To
get the information like, CPU usage, request per second, total traffic, etc., just
enable ExtendedStatus.
<<To enable it just jump to line no 228 and uncomment it:>>
<<To enable it just jump to line no 228 and uncomment it:>>
ExtendedStatus On
Step4:
Restart apache service
# service httpd restart
# chkconfig httpd on
# chkconfig httpd on
Step5: Now,
open browser and access link:
http://192.168.10.138/server-status
OR
http://site1.example.com/server-status
As result, we will get output like:
Step6: There is no need to refresh manually this page time by time. We can set time to get this page refresh. To set the automate refresh, we can add '?refresh=N' in the end of the URL. Like:
Step6: There is no need to refresh manually this page time by time. We can set time to get this page refresh. To set the automate refresh, we can add '?refresh=N' in the end of the URL. Like:
http://site1.example.com/server-status/?refresh=5
No comments:
Post a Comment