Apache Server Status with mod_status

Published on September 1, 2011, by in sysadmin.



Apache has a built-in web-based server status module called mod_status. Here’s how it works!




In Ubuntu / Debian, first enable the apache status module:

$ sudo a2enmod status


An existing config file is already in place for Debian and Ubuntu. Edit as follows:

$ sudo nano /etc/apache2/mods-available/status.conf



It looks like this:

< IfModule mod_status.c >
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Uncomment and change the ".example.com" to allow
# access from other hosts.
#
< Location /server-status >
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from localhost ip6-localhost
#    Allow from .example.com
< /Location >

< /IfModule >





Add ExtendedStatus On above the Location directive to give more details such as CPU load, number of requests, and other information.

< IfModule mod_status.c >
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Uncomment and change the ".example.com" to allow
# access from other hosts.
#

ExtendedStatus On

< Location /server-status >
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from localhost ip6-localhost
#    Allow from .example.com
< /Location >

< /IfModule >




Save changes, then restart apache.




View server status locally with links2:

$ links2 http://localhost/server-status



Add a refresh setting to the end to auto-refresh specified seconds:

$ links2 http://localhost/server-status?refresh=5


mod_status




(If you make the page public, consider using apache auth, or restricting the ip for access.)

View an example server-status html page here (new window).



Cool!

Related posts:

  1. shellinabox With Apache Authentication Over HTTPS 443
  2. Could not reliably determine the server’s fully qualified domain name
  3. Apache Block By User Agent

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Home sysadmin Apache Server Status with mod_status
© Copyleft scottlinux.com CC BY-SA 3.0