/* Licensed to the Apache Software Foundation (ASF) under one or more *contributorlicenseagreements.SeetheNOTICEfiledistributedwith *thisworkforadditionalinformationregardingcopyrightownership. *TheASFlicensesthisfiletoYouundertheApacheLicense,Version2.0 *(the"License");youmaynotusethisfileexceptincompliancewith *theLicense.YoumayobtainacopyoftheLicenseat * *http://www.apache.org/licenses/LICENSE-2.0 * *Unlessrequiredbyapplicablelaworagreedtoinwriting,software *distributedundertheLicenseisdistributedonan"ASIS"BASIS, *WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied. *SeetheLicenseforthespecificlanguagegoverningpermissionsand *limitationsundertheLicense.
*/
/* Status Module. Display lots of internal data about how Apache is *performingandthestateofallchildrenprocesses. * *Toenablethis,addthefollowinglinesintoanyconfigfile: * *<Location/server-status> *SetHandlerserver-status *</Location> * *Youmaywanttoprotectthislocationbypasswordordomainsonoone *elsecanlookatit.ThenyoucanaccessthestatisticswithaURLlike: * *http://your_server_name/server-status * */server-status-Returnspageusingtables */server-status?notable-Returnspageforbrowserswithouttablesupport */server-status?refresh-Returnspagewith1secondrefresh */server-status?refresh=6-Returnspagewithrefreshevery6seconds */server-status?auto-Returnspagewithdataforautomaticparsing * *MarkCox,mark@ukweb.com,November1995 * *12.11.95Initialversionforwww.telescope.org *13.3.96Updatedtoremoverprintf's[Mark] *18.3.96AddedCPUusage,processinformation,andtidied[BenLaurie] *18.3.96MakeextraScoreboardvariables#definable *25.3.96Makeshortreporthavefullprecision[BenLauriesuggested] *25.3.96Showuptimebetter[Mark/BenLaurie] *29.3.96BetterHTMLandexplanation[Mark/RobHartillsuggested] *09.4.96Addedmessagefornon-STATUScompiledversion *18.4.96Addedperchildandperslotcounters[JimJagielski] *01.5.96Tableformat,cleanup,evenmorespiffydata[ChuckMurcko/JimJ.] *18.5.96Adaptedtousenewrprintf()routine,incidentallyfixingamissing *pieceinshortreports[BenLaurie] *21.5.96AdditionalStatuscodes(DNSandLOGGINGonlyenabledif *extendedSTATUSisenabled)[GeorgeBurgyan/JimJ.] *10.8.98Allowforextendedstatusinfoatruntime(nomoreSTATUS) *[JimJ.]
*/
#ifdef HAVE_TIMES /* ugh... need to know if we're running with a pthread implementation *suchaslinuxthreadsthattreatsindividualthreadsasdistinct *processes;thataffectshowweaddupCPUtimeinaprocess
*/ static pid_t child_pid; #endif
/* add another state for slots above the MaxRequestWorkers setting */ #define SERVER_DISABLED SERVER_NUM_STATUS #define MOD_STATUS_NUM_STATUS (SERVER_NUM_STATUS+1)
staticchar status_flags[MOD_STATUS_NUM_STATUS];
staticint status_handler(request_rec *r)
{ constchar *loc;
apr_time_t nowtime;
apr_uint32_t up_time;
ap_loadavg_t t; int j, i, res, written; int idle; int graceful; int busy; unsignedlong count; unsignedlong lres, my_lres, conn_lres;
apr_off_t bytes, my_bytes, conn_bytes;
apr_off_t bcount, kbcount; long req_time;
apr_time_t duration_global;
apr_time_t duration_slot; int short_report; int no_table_report;
global_score *global_record;
worker_score *ws_record;
process_score *ps_record; char *stat_buffer;
pid_t *pid_buffer, worker_pid; int *thread_idle_buffer = NULL; int *thread_graceful_buffer = NULL; int *thread_busy_buffer = NULL;
clock_t tu, ts, tcu, tcs;
clock_t gu, gs, gcu, gcs;
ap_generation_t mpm_generation, worker_generation; #ifdef HAVE_TIMES float tick; int times_per_thread; #endif
if (strcmp(r->handler, STATUS_MAGIC_TYPE) && strcmp(r->handler, "server-status")) { return DECLINED;
}
if (r->args) {
i = 0; while (status_options[i].id != STAT_OPT_END) { if ((loc = ap_strstr_c(r->args,
status_options[i].form_data_str)) != NULL) { switch (status_options[i].id) { case STAT_OPT_REFRESH: {
apr_size_t len = strlen(status_options[i].form_data_str); long t = 0;
if (*(loc + len ) == '=') {
t = atol(loc + len + 1);
}
apr_table_setn(r->headers_out,
status_options[i].hdr_out_str,
apr_ltoa(r->pool, t < 1 ? 10 : t)); break;
} case STAT_OPT_NOTABLE:
no_table_report = 1; break; case STAT_OPT_AUTO:
ap_set_content_type_ex(r, "text/plain; charset=ISO-8859-1", 1);
short_report = 1; break;
}
}
if (!ps_record->quiescing
&& ps_record->pid) { if (res == SERVER_READY) { if (ps_record->generation == mpm_generation)
idle++; if (is_async)
thread_idle_buffer[i]++;
} elseif (res != SERVER_DEAD &&
res != SERVER_STARTING &&
res != SERVER_IDLE_KILL) { if (res == SERVER_GRACEFUL) {
graceful++; if (is_async)
thread_graceful_buffer[i]++;
} else {
busy++; if (is_async)
thread_busy_buffer[i]++;
}
}
}
/* XXX what about the counters for quiescing/seg faulted *processes?shouldtheybecountedornot?GLA
*/ if (ap_extended_status) {
lres = ws_record->access_count;
bytes = ws_record->bytes_served;
if (!no_table_report) {
ap_rputs("</table>\n \
<hr /> \
<table>\n \
<tr><th>Srv</th><td>Child Server number - generation</td></tr>\n \
<tr><th>PID</th><td>OS process ID</td></tr>\n \
<tr><th>Acc</th><td>Number of accesses this connection / this child / this slot</td></tr>\n \
<tr><th>M</th><td>Mode of operation</td></tr>\n"
#ifdef HAVE_TIMES "<tr><th>CPU</th><td>CPU usage, number of seconds</td></tr>\n" #endif
"<tr><th>SS</th><td>Seconds since beginning of most recent request</td></tr>\n \
<tr><th>Req</th><td>Milliseconds required to process most recent request</td></tr>\n \
<tr><th>Dur</th><td>Sum of milliseconds required to process all requests</td></tr>\n \
<tr><th>Conn</th><td>Kilobytes transferred this connection</td></tr>\n \
<tr><th>Child</th><td>Megabytes transferred this child</td></tr>\n \
<tr><th>Slot</th><td>Total megabytes transferred this slot</td></tr>\n \
</table>\n", r);
}
} /* if (ap_extended_status && !short_report) */ else {
if (!short_report) {
ap_rputs("<hr />To obtain a full report with current status " "information you need to use the " "<code>ExtendedStatus On</code> directive.\n", r);
}
}
{ /* Run extension hooks to insert extra content. */ int flags =
(short_report ? AP_STATUS_SHORT : 0) |
(no_table_report ? AP_STATUS_NOTABLE : 0) |
(ap_extended_status ? AP_STATUS_EXTENDED : 0);
ap_run_status_hook(r, flags);
}
if (!short_report) {
ap_rputs(ap_psignature("<hr />\n",r), r);
ap_rputs("</body></html>\n", r);
}
return0;
}
staticint status_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp)
{ /* When mod_status is loaded, default our ExtendedStatus to 'on' *othermoduleswhichpreferverbosescoreboardsmayplayasimilargame. *Iflefttotheirownrequirements,mpmmodulescanmakedowithsimple *scoreboardentries.
*/
ap_extended_status = 1; return OK;
}
staticint status_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp,
server_rec *s)
{
status_flags[SERVER_DEAD] = '.'; /* We don't want to assume these are in */
status_flags[SERVER_READY] = '_'; /* any particular order in scoreboard.h */
status_flags[SERVER_STARTING] = 'S';
status_flags[SERVER_BUSY_READ] = 'R';
status_flags[SERVER_BUSY_WRITE] = 'W';
status_flags[SERVER_BUSY_KEEPALIVE] = 'K';
status_flags[SERVER_BUSY_LOG] = 'L';
status_flags[SERVER_BUSY_DNS] = 'D';
status_flags[SERVER_CLOSING] = 'C';
status_flags[SERVER_GRACEFUL] = 'G';
status_flags[SERVER_IDLE_KILL] = 'I';
status_flags[SERVER_DISABLED] = ' ';
ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &thread_limit);
ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &server_limit);
ap_mpm_query(AP_MPMQ_MAX_THREADS, &threads_per_child); /* work around buggy MPMs */ if (threads_per_child == 0)
threads_per_child = 1;
ap_mpm_query(AP_MPMQ_MAX_DAEMONS, &max_servers);
ap_mpm_query(AP_MPMQ_IS_ASYNC, &is_async); return OK;
}
AP_DECLARE_MODULE(status) =
{
STANDARD20_MODULE_STUFF,
NULL, /* dir config creater */
NULL, /* dir merger --- default is to override */
NULL, /* server config */
NULL, /* merge server config */
NULL, /* command table */
register_hooks /* register_hooks */
};
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.21Bemerkung:
(vorverarbeitet am 2026-09-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.