To the uninitiated, the
mod_status output can look like so much gobbledegook, but it’s really quite straightforward. Let’s take a look at some sample output.
The first few lines identify and provide a brief description of your server. The server version information includes an incomplete list of some of the modules compiled into your server. Our example server is running on a Unix system and has been compiled with support for the PHP scripting language. (The level of detail provided by the server version line may be limited by the ServerTokens configuration directive.)
The next block represents the server’s current state. Our example server has only been up for a few minutes and hasn’t yet seen much activity. It is currently dealing with three requests, one of which is my request for the server status itself. The message that five servers are idle servers is a clue that this server is configured to maintain a pool of at least five spare child processes ready to spring into action should the need arise.
No, that’s not boring morse-code; it’s the “scoreboard,” a pseudo-graphical representation of the state of the server’s child processes. According to the included Scoreboard Key, our server is replying to one request, maintaining two KeepAlive connections, and is maintaining five idle processes. A busier server’s scoreboard would look more like:
For more on pool regulation and KeepAlive, see my earlier HTTP Wrangler column, “An Amble Through Apache Configuration.”
In addition to a more general overview of your server’s activity,
Apache Server Status for somedomain.com Server Version: Apache/1.3.9 (Unix) PHP/4.0b3 Server Built: Mar 4 2000 17:01:01gets down to the nitty-gritty, displaying a snapshot of the individual requests it is currently handling. Let’s take a gander at a fairly representative request. Please note that the output above has been split in half for display purposes.
The ID of the child process and its generation. The generation increases each time a child process is restarted, whether due to a server-restart or a limit placed on the number of processes a child is allowed to handle. See the MaxRequestsPerChild directive.
The child’s process ID.
The first number in this trio is the number of accesses or requests using this connection. For non-KeepAlive connections, this will be 0 since each request makes its own connection and so is always the first (and last). The second is the number of requests handled thus far by this child. The third is the number of requests handled by this slot; the child may have come and gone, its slot taken by another.
The child’s mode of operation; one of the following possibilities:
||CPU SS Req Conn Child Slot
Some of the less useful bits and pieces…
CPU: The child’s CPU usage in number of seconds.
Perhaps your server hosts multiple virtual domains; how would you determine which page is being requested by
This particular hit is my request for server-status. The
For more on HTTP, see my earlier HTTP Wrangler column, “Introducing Apache.”
So how do you install and configure
GET /index.html? I make the assumption here that you built and installed Apache from source. If you’re not familiar with building Apache, may I suggest you read my earlier HTTP Wrangler column, Getting, Installing, and Running Apache.
First, move into your Apache source directory.
GET /server-status HTTP/1.0script creates a cache file,
GET, saving us the bother of completely reconfiguring our Apache build from scratch. All we need to do is run
wget, supplying the one argument necessary to add
If you’ve not already done so, now would be the time to become
mod_statusscript automagically updates
% cd /usr/local/src/apache_1.3.xto include
configure; next time you configure you will not need to enable
Now that we’ve reconfigured Apache, let’s rebuild.
Your screen should look something like:
Finally, you’re ready to install your newly freshly built Apache.
(While not strictly necessary — reinstalling should only overwrite files that probably haven’t changed since your last install — I always advise backing up your Apache directory.)
config.status is easy to configure; in fact the directives already exist in your
mod_status file and simply need to be uncommented and edited slightly. If you’re not familiar with Apache configuration, may I suggest you read my earlier HTTP Wrangler column, An Amble Through Apache Configuration.
(or wherever your Apache installation’s configuration files are located)
root file in the text editor of your choice and search for the following set of configuration directives:
Uncomment everything from
# ./config.status --enable-module=status Configuring for Apache, Version 1.3.11 ... Creating Makefile Creating Configuration.apaci in src Creating Makefile in src + configured for Linux platform + setting C compiler to gcc + setting C pre-processor to gcc -E + checking for system header files + adding selected modules + checking sizeof various data types + doing sanity check on compiler and options ... Creating Makefile in src/modules/standardto
configureby removing the
config.statuscharacters from the beginning of each line.
It’s wise to protect your server-status output from prying eyes. The easiest way to do this is to restrict its access to one computer or domain. Change the
mod_status to the name of a computer or domain you wish to allow a peek at server-status. For example, if you’re the webmaven for your server, you may want to allow only your computer,
mod_status access, your server-status configuration would look something like:
Only one tiny piece left. The default status display isn’t as detailed as what you I showed you above. The more abbreviated version looks something like:
In order to see all the gory details, you need to enable “full” status. Find the following lines and uncomment (remove the initial
# make) the
# make ===&gt; src make: Entering directory `src/httpd/apache_1.3.11' make: Entering directory `src/httpd/apache_1.3.11/src' ===&gt; src/regex ... [several unsightly lines later] ... gcc -DLINUX=2 -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -DNO_DL_NEEDED `../apaci` -o ab -L../os/unix -L../ap ab.o -lap -los -lm -lcrypt make: Leaving directory `src/httpd/apache_1.3.11/src/support' &lt;=== src/support make: Leaving directory `src/httpd/apache_1.3.11' &lt;=== src #directive; the result should look like:
That’s all there is to
# make installconfiguration. Save your
Mod_statusfile, shut down and start Apache.
Fire up your Web browser on a machine allowed access to your server’s server-status and point it at the URL:
Happy reading! For more information on
httpd.confand other aspects of Apache we touched on along the way, visit the Resources section below.