mod_status.c revision 217bfe402837e5f978d351f3a3135118307b498d
142N/A/* ==================================================================== 142N/A * The Apache Software License, Version 1.1 142N/A * Copyright (c) 2000-2001 The Apache Software Foundation. All rights 142N/A * Redistribution and use in source and binary forms, with or without 142N/A * modification, are permitted provided that the following conditions 142N/A * 1. Redistributions of source code must retain the above copyright 142N/A * notice, this list of conditions and the following disclaimer. 142N/A * 2. Redistributions in binary form must reproduce the above copyright 142N/A * notice, this list of conditions and the following disclaimer in 142N/A * the documentation and/or other materials provided with the 142N/A * 3. The end-user documentation included with the redistribution, 142N/A * if any, must include the following acknowledgment: 142N/A * "This product includes software developed by the 5533N/A * Alternately, this acknowledgment may appear in the software itself, 142N/A * if and wherever such third-party acknowledgments normally appear. 142N/A * 4. The names "Apache" and "Apache Software Foundation" must 142N/A * not be used to endorse or promote products derived from this 1273N/A * software without prior written permission. For written 7086N/A * permission, please contact apache@apache.org. 1273N/A * 5. Products derived from this software may not be called "Apache", 1273N/A * nor may "Apache" appear in their name, without prior written 142N/A * permission of the Apache Software Foundation. 7086N/A * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 4280N/A * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1273N/A * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 142N/A * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 142N/A * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 6481N/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 844N/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 6481N/A * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 6481N/A * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 142N/A * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 7086N/A * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3996N/A * ==================================================================== 3996N/A * This software consists of voluntary contributions made by many 142N/A * individuals on behalf of the Apache Software Foundation. For more 4132N/A * information on the Apache Software Foundation, please see 4280N/A * Portions of this software are based upon public domain software 4280N/A * originally written at the National Center for Supercomputing Applications, 4280N/A * University of Illinois, Urbana-Champaign. 4280N/A/* Status Module. Display lots of internal data about how Apache is 4280N/A * performing and the state of all children processes. 4280N/A * To enable this, add the following lines into any config file: 6481N/A * <Location /server-status> 142N/A * You may want to protect this location by password or domain so no one 142N/A * else can look at it. Then you can access the statistics with a URL like: 2644N/A * /server-status - Returns page using tables 2644N/A * /server-status?notable - Returns page for browsers without table support 142N/A * /server-status?refresh - Returns page with 1 second refresh 142N/A * /server-status?refresh=6 - Returns page with refresh every 6 seconds 142N/A * /server-status?auto - Returns page with data for automatic parsing 4280N/A * Mark Cox, mark@ukweb.com, November 1995 4005N/A * 13.3.96 Updated to remove rprintf's [Mark] 3996N/A * 18.3.96 Added CPU usage, process information, and tidied [Ben Laurie] 3996N/A * 18.3.96 Make extra Scoreboard variables #definable 3996N/A * 25.3.96 Make short report have full precision [Ben Laurie suggested] * 25.3.96 Show uptime better [Mark/Ben Laurie] * 29.3.96 Better HTML and explanation [Mark/Rob Hartill suggested] * 09.4.96 Added message for non-STATUS compiled version * 18.4.96 Added per child and per slot counters [Jim Jagielski] * 01.5.96 Table format, cleanup, even more spiffy data [Chuck Murcko/Jim J.] * 18.5.96 Adapted to use new rprintf() routine, incidentally fixing a missing * piece in short reports [Ben Laurie] * 21.5.96 Additional Status codes (DNS and LOGGING only enabled if * extended STATUS is enabled) [George Burgyan/Jim J.] * 10.8.98 Allow for extended status info at runtime (no more STATUS) #
define GBYTE 1073741824L *command-related code. This is here to prevent use of ExtendedStatus * without status_module included. "\"On\" to enable extended status information, \"Off\" to disable"),
/* Format the number of bytes nicely */ /* Main handler for x-httpd-status requests */ /* ID values for command table */ "Server status unavailable in inetd mode");
* Simple table-driven form data set parser that lets you alter the header /* ap_sync_scoreboard_image(); */ "<HTML><HEAD>\n<TITLE>Apache Status</TITLE>\n</HEAD><BODY>\n",
ap_rputs(
"<H1>Apache Server Status for ", r);
ap_rprintf(r,
"Total Accesses: %lu\nTotal kBytes: %lu\n",
/* Allow for OS/2 not having CPU stats */ else {
/* !short_report */ /* Allow for OS/2 not having CPU stats */ }
/* ap_extended_status */ ap_rprintf(r,
"\n%d requests currently being processed, %d idle servers\n" /* send the scoreboard 'table' out */ ap_rputs(
"\"<B><code>_</code></B>\" Waiting for Connection, \n", r);
ap_rputs(
"\"<B><code>S</code></B>\" Starting up, \n", r);
ap_rputs(
"\"<B><code>R</code></B>\" Reading Request,<BR>\n", r);
ap_rputs(
"\"<B><code>W</code></B>\" Sending Reply, \n", r);
ap_rputs(
"\"<B><code>K</code></B>\" Keepalive (read), \n", r);
ap_rputs(
"\"<B><code>D</code></B>\" DNS Lookup,<BR>\n", r);
ap_rputs(
"\"<B><code>L</code></B>\" Logging, \n", r);
ap_rputs(
"\"<B><code>G</code></B>\" Gracefully finishing, \n", r);
ap_rputs(
"\"<B><code>I</code></B>\" Idle cleanup of worker, \n", r);
ap_rputs(
"\"<B><code>.</code></B>\" Open slot with no current process<P>\n", r);
ap_rputs(
"<p><hr><h2>Server Details</h2>\n\n", r);
/* Allow for OS/2 not having CPU stats */ ap_rputs(
"<p>\n\n<table border=0><tr><th>Srv<th>PID<th>Acc<th>M\n<th>SS<th>Req<th>Conn<th>Child<th>Slot<th>Client<th>VHost<th>Request</tr>\n\n", r);
ap_rputs(
"<p>\n\n<table border=0><tr><th>Srv<th>PID<th>Acc<th>M<th>CPU\n<th>SS<th>Req<th>Conn<th>Child<th>Slot<th>Client<th>VHost<th>Request</tr>\n\n", r);
"<b>Server %d-%d</b> (-): %d|%lu|%lu [",
/* Allow for OS/2 not having CPU stats */ ap_rprintf(r,
" <i>%s {%s}</i> <b>[%s]</b><br>\n\n",
else {
/* !no_table_report */ "<tr><td><b>%d-%d</b><td>-<td>%d/%lu/%lu",
/* Allow for OS/2 not having CPU stats */ "<td>?<td nowrap>?<td nowrap>..reading.. </tr>\n\n");
"<td>%s<td nowrap>%s<td nowrap>%s</tr>\n\n",
}
/* if (<active child>) */<tr><th>Srv<td>Child Server number - generation\n \ <tr><th>PID<td>OS process ID\n \ <tr><th>Acc<td>Number of accesses this connection / this child / this slot\n \ <tr><th>M<td>Mode of operation\n \ <tr><th>SS<td>Seconds since beginning of most recent request\n \ <tr><th>Req<td>Milliseconds required to process most recent request\n \ <tr><th>Conn<td>Kilobytes transferred this connection\n \ <tr><th>Child<td>Megabytes transferred this child\n \ <tr><th>Slot<td>Total megabytes transferred this slot\n \ <tr><th>Srv<td>Child Server number - generation\n \ <tr><th>PID<td>OS process ID\n \ <tr><th>Acc<td>Number of accesses this connection / this child / this slot\n \ <tr><th>M<td>Mode of operation\n \ <tr><th>CPU<td>CPU usage, number of seconds\n \ <tr><th>SS<td>Seconds since beginning of most recent request\n \ <tr><th>Req<td>Milliseconds required to process most recent request\n \ <tr><th>Conn<td>Kilobytes transferred this connection\n \ <tr><th>Child<td>Megabytes transferred this child\n \ <tr><th>Slot<td>Total megabytes transferred this slot\n \ ap_rputs(
"<hr>To obtain a full report with current status information ", r);
ap_rputs(
"you need to use the <code>ExtendedStatus On</code> directive. \n", r);
NULL,
/* dir config creater */ NULL,
/* dir merger --- default is to override */ NULL,
/* server config */ NULL,
/* merge server config */