]> granicus.if.org Git - apache/commitdiff
Merge r1671396, r1672289, r1672453 from trunk:
authorJim Jagielski <jim@apache.org>
Sun, 19 Apr 2015 18:04:32 +0000 (18:04 +0000)
committerJim Jagielski <jim@apache.org>
Sun, 19 Apr 2015 18:04:32 +0000 (18:04 +0000)
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

STATUS
modules/generators/mod_status.c

diff --git a/STATUS b/STATUS
index 0e628e2aa86bf0069d13986da246b53dc70d5bc7..b8379e56062ebc6fc893b3837b5a0253b56b9bf7 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -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).
index 6bcf592b57703eba1898337a3a9a1c06dc34a5b3..9bd4e8aa04e84c2965b6bae9964e1864d64606a3 100644 (file)
@@ -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.);