Monitor Your Apache Load and Stats with mod_status

Apache HTTP Server is very extensible, allowing users to easily add new modules and thus new features and functionality. One such module that is helpful for monitoring your Apache web server is mod_status. mod_status keeps track of your web server’s load and displays it along with current httpd connections in a web-based interface.

mod_status displays a number of helpful details, including:

  • total number of incoming requests
  • percentage of CPU used by each worker, as well as the overall total
  • number of workers serving requests
  • server uptime
  • number of idle workers
  • total traffic

The output is displayed in plain HTML and is easy to read. You can view a demo of a mod_status output page on the Apache Foundation’s own website.

To enable mod_status in CentOS, edit your Apache configuration file (/etc/httpd/conf/httpd.conf) and find the line that says:

# LoadModule status_module modules/mod_status.so

Remove the “#” from in front of it to enable it.

Next, scroll down and find the lines that look like this:

# 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>

Uncomment it and change the “.example.com” to the appropriate domain that you want to use. You will need to repeat this step for virtual hosts, setting the correct domain for each in its own configuration file.

Finally, you can add addition information to the status page by enabled ExtendedStatus in httpd.conf.

ExtendedStatus On

For more information about mod_status as well as other Apache modules, see the Apache 2 documentation site.











Comments: