start page | rating of books | rating of authors | reviews | copyrights

Book HomeApache: The Definitive GuideSearch this book

11.3. Server Status

For this exercise, the httpd.conf in ... /site.status file should look like this:

User webuser
Group webgroup
ServerName www.butterthlies.com
DocumentRoot /usr/www/site.status/htdocs

<Location /status>
order deny, allow
allow from 192.168.123.1
deny from all
SetHandler server-status
</Location>

<Location /info>
order deny, allow
allow from 192.168.123.1
deny from all
SetHandler server-status
SetHandler server-info
</Location>

The allow from directive keeps our laundry private.

Remember the way order works: the last entry has the last word. Notice also the use of SetHandler , which sets a handler for all requests to a directory, instead of AddHandler, which specifies a handler for particular file extensions. If you then access www.butterthlies.com/status, you get this response:

Apache Server Status for www.butterthlies.com
Server Version: Apache/1.3.1 (Unix)
Server Built: Sep 15 1998 15:09:34
Current Time: Tuesday, 13-Oct-1998 08:16:08 
Restart Time: Tuesday, 13-Oct-1998 08:15:13 
Server uptime: 55 seconds
Total accesses: 1 - Total Traffic: 0 kB
CPU Usage: u0 s0 cu0 cs0
.0182 requests/sec - 0 B/second - 0 B/request
1 requests currently being processed, 5 idle servers 
_W____..........................................................
................................................................
................................................................
................................................................
Scoreboard Key: 
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"L" Logging, "G" Gracefully finishing, "." Open slot with no current process

Srv PID  Acc   M  CPU   SS Req Conn  Child Slot     Host             Vhost                 Request
0   157 0/1/1  -  0.00  10  54  0.0  0.000 0.000 192.168.123.1 www.butterthlies.com   GET /mycgi.cgi HTTP/1.0
1   158 0/0/0  W  0.00  54   0  0.0  0.00  0.00  192.168.123.1 www.butterthlies.com   GET /status HTTP/1.0

Srv   Server number 
PID   OS process ID 
Acc   Number of accesses this connection / this child / this slot 
M     Mode of operation 
CPU   CPU usage, number of seconds 
SS    Seconds since beginning of most recent request 
Req   Milliseconds required to process most recent request 
Conn  Kilobytes transferred this connection 
Child Megabytes transferred this child 
Slot  Total megabytes transferred this slot

There are several useful variants on the basic status request:

status?notable

Returns the status without using tables, for browsers with no table support

status?refresh

Updates the page once a second

status?refresh=6

Updates the page every six seconds

status?auto

Returns the status in a format suitable for processing by a program

These can also be combined by putting a comma between them, for example: http://www.butterthlies.com/status?notable,refresh=10.



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.