The Apache module mod_status allows for an administrator to monitor the performance and activity of their web server. mod_status will provide the following information to the viewer:
- The number of worker serving requests
- The number of idle worker
- The time the server was started/restarted and the time it has been running for
The status module can also be set to an extended mode, which will displaying additional information:
- The status of each worker, the number of requests that worker has performed and the total number of bytes served by the worker
- A total number of accesses and byte count serve
- Averages giving the number of requests per second, the number of bytes served per second and the average number of bytes per request
- The current percentage CPU used by each worker and in total by Apache
- The current hosts and requests being processed
Enable
The mod_status module is already installed on default httpd (apache) installs on CentOS and Redhat Linux, and already loaded into the config. However, to access the information, the Apache config must be updated to set the handler for the request.
To set the handler, the Apache config file at /etc/httpd/conf/httpd.conf must be edited. Open the file (using vi, nano, or your preferred editor), and search for the following block:
#
# 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>
Edit this block, to resemble the following:
#
# 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
</Location>
Save your changes, and have Apache reload it's configuration.
service httpd reload
Now all requests with '/server-status' to your server will display the mod_status information page. Ex; http://server-ip/server-status
Extended Status
To enable the extended status information, edit the httpd.conf file again, and find the following configuration block:
#
# 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
Edit this config, to un-comment the ExtendedStatus line:
#
# 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
And then reload Apache again as before.