From: Rainer Jung Date: Sun, 5 Apr 2015 13:34:01 +0000 (+0000) Subject: Add more data to "?auto" view of server-status. X-Git-Tag: 2.5.0-alpha~3332 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0450264e71e714882023cb971fcf8c7164a7fb71;p=apache Add more data to "?auto" view of server-status. Although mod_status source code calls this the "short_report", the docs and the API flag call it "Machine Readable" resp. "STAT_OPT_AUTO". So IMHO the data shown should be on par with the html version. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1671396 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/generators/mod_status.c b/modules/generators/mod_status.c index 6bcf592b57..37f8f2fc01 100644 --- a/modules/generators/mod_status.c +++ b/modules/generators/mod_status.c @@ -126,7 +126,7 @@ static void format_kbyte_out(request_rec *r, apr_off_t kbytes) ap_rprintf(r, "%.1f GB", (float) kbytes / MBYTE); } -static void show_time(request_rec *r, apr_interval_time_t tsecs) +static void show_time(request_rec *r, apr_uint32_t tsecs) { int days, hrs, mins, secs; @@ -183,7 +183,8 @@ static int status_handler(request_rec *r) { const char *loc; apr_time_t nowtime; - apr_interval_time_t up_time; + apr_uint32_t up_time; + ap_loadavg_t t; int j, i, res, written; int ready; int busy; @@ -391,10 +392,9 @@ static int status_handler(request_rec *r) /* up_time in seconds */ up_time = (apr_uint32_t) apr_time_sec(nowtime - ap_scoreboard_image->global->restart_time); + ap_get_loadavg(&t); if (!short_report) { - ap_loadavg_t t; - ap_rputs(DOCTYPE_HTML_3_2 "\n" "Apache Status\n" @@ -424,10 +424,38 @@ static int status_handler(request_rec *r) ap_rputs("
Server uptime: ", r); show_time(r, up_time); ap_rputs("
\n", r); - ap_get_loadavg(&t); ap_rprintf(r, "
Server load: %.2f %.2f %.2f
\n", t.loadavg, t.loadavg5, t.loadavg15); } + else { + ap_rvputs(r, ap_get_server_name(r), "\n", NULL); + ap_rvputs(r, "ServerVersion: ", + ap_get_server_description(), "\n", NULL); + ap_rvputs(r, "ServerMPM: ", + ap_show_mpm(), "\n", NULL); + ap_rvputs(r, "Server Built: ", + ap_get_server_built(), "\n", NULL); + ap_rvputs(r, "CurrentTime: ", + ap_ht_time(r->pool, nowtime, DEFAULT_TIME_FORMAT, 0), + "\n", NULL); + ap_rvputs(r, "RestartTime: ", + ap_ht_time(r->pool, + ap_scoreboard_image->global->restart_time, + DEFAULT_TIME_FORMAT, 0), + "\n", NULL); + ap_rprintf(r, "ParentServerConfigGeneration: %d\n", + ap_state_query(AP_SQ_CONFIG_GEN)); + ap_rprintf(r, "ParentServerMPMGeneration: %d\n", + (int)mpm_generation); + ap_rputs("ServerUptimeSeconds: ", r); + ap_rprintf(r, "ServerUptimeSeconds: %u\n", + up_time); + ap_rputs("ServerUptime:", r); + show_time(r, up_time); + ap_rputs("\n", r); + ap_rprintf(r, "Load1: %.2f\nLoad5: %.2f\nLoad15: %.2f\n", + t.loadavg, t.loadavg5, t.loadavg15); + } if (ap_extended_status) { if (short_report) { @@ -437,6 +465,9 @@ static int status_handler(request_rec *r) #ifdef HAVE_TIMES /* Allow for OS/2 not having CPU stats */ + ap_rprintf(r, "CPUUser: %g\nCPUSystem: %g\nCPUChildrenUser: %g\nCPUChildrenSystem: %g", + tu / tick, ts / tick, tcu / tick, tcs / tick); + if (ts || tu || tcu || tcs) ap_rprintf(r, "CPULoad: %g\n", (tu + ts + tcu + tcs) / tick / up_time * 100.);