Commit 161b5209 authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Merge r1671396, r1672289, r1672453 from trunk:

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.


Followon to r1671396:
Remove unwanted redundant output introduced
by that commit.


Followon to r1671396: add misiing newline in
new server-status output.

Submitted by: rjung
Reviewed/backported by: jim


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1674659 13f79535-47bb-0310-9956-ffa450edef68
parent aa135b62
Loading
Loading
Loading
Loading
+0 −9
Changes for STATUS: 0 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -105,15 +105,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

  *) mod_status: Improve server-status output when called with "?auto"
     (machine readable form).
     trunk patch: http://svn.apache.org/r1671396
                  http://svn.apache.org/r1672289
                  http://svn.apache.org/r1672453
     2.4.x patch: http://people.apache.org/~rjung/patches/enhance-server-status-auto.patch
                  (same as trunk but combined into one)
     +1: rjung, covener, jim

  *) mod_ssl, mod_proxy, mod_cache_socache, mod_socache_*: Add plain text
     output to status hook (server-status) when called with "?auto"
     (machine readable form).
+35 −5
Changes for modules/generators/mod_status.c: 35 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -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
                 "<html><head>\n"
                 "<title>Apache Status</title>\n"
@@ -424,10 +424,37 @@ static int status_handler(request_rec *r)
        ap_rputs("<dt>Server uptime: ", r);
        show_time(r, up_time);
        ap_rputs("</dt>\n", r);
        ap_get_loadavg(&t);
        ap_rprintf(r, "<dt>Server load: %.2f %.2f %.2f</dt>\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_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 +464,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\n",
                       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.);