ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Humanize stub status



Добрый день.

В процессе работы над nginx был модифицирован stub_status что бы выводил
информацию в более понятном, для не посвященных, виде. Терять этот патч, не
интересно. Может кому-то он поможет.

diff -r f4db43d828ac src/http/modules/ngx_http_stub_status_module.c
--- a/src/http/modules/ngx_http_stub_status_module.c    Wed Feb 27 21:35:43 
2008 +0300
+++ b/src/http/modules/ngx_http_stub_status_module.c    Thu Feb 28 13:25:16 
2008 +0300
@@ -88,10 +88,13 @@ static ngx_int_t ngx_http_status_handler
         }
     }
 
-    size = sizeof("Active connections:  \n") + NGX_ATOMIC_T_LEN
-           + sizeof("server accepts handled requests\n") - 1
-           + 6 + 3 * NGX_ATOMIC_T_LEN
-           + sizeof("Reading:  Writing:  Waiting:  \n") + 3 * NGX_ATOMIC_T_LEN;
+    size = sizeof("Active connections: \n") + NGX_ATOMIC_T_LEN
+      + sizeof("Accepted connections: \n") + NGX_ATOMIC_T_LEN
+      + sizeof("Handled connections: \n") + NGX_ATOMIC_T_LEN
+      + sizeof("Reading connections: \n") + NGX_ATOMIC_T_LEN
+      + sizeof("Writing connections: \n") + NGX_ATOMIC_T_LEN
+      + sizeof("Waiting connections: \n") + NGX_ATOMIC_T_LEN
+      + sizeof("Total requests: \n") + NGX_ATOMIC_T_LEN;
 
     b = ngx_create_temp_buf(r->pool, size);
     if (b == NULL) {
@@ -108,15 +111,14 @@ static ngx_int_t ngx_http_status_handler
     rd = *ngx_stat_reading;
     wr = *ngx_stat_writing;
 
-    b->last = ngx_sprintf(b->last, "Active connections: %uA \n", ac);
 
-    b->last = ngx_cpymem(b->last, "server accepts handled requests\n",
-                         sizeof("server accepts handled requests\n") - 1);
-
-    b->last = ngx_sprintf(b->last, " %uA %uA %uA \n", ap, hn, rq);
-
-    b->last = ngx_sprintf(b->last, "Reading: %uA Writing: %uA Waiting: %uA \n",
-                          rd, wr, ac - (rd + wr));
+    b->last = ngx_sprintf(b->last, "Active connections: %uA\n", ac);
+    b->last = ngx_sprintf(b->last, "Accepted connections: %uA\n", ap);
+    b->last = ngx_sprintf(b->last, "Handled connections: %uA\n", hn);
+    b->last = ngx_sprintf(b->last, "Reading connections: %uA\n", rd);
+    b->last = ngx_sprintf(b->last, "Writing connections: %uA\n", wr);
+    b->last = ngx_sprintf(b->last, "Waiting connections: %uA\n", ac - (rd + 
wr));
+    b->last = ngx_sprintf(b->last, "Total requests: %uA\n", rq);
 
     r->headers_out.status = NGX_HTTP_OK;
     r->headers_out.content_length_n = b->last - b->pos;

-- 
| |*| |  Kirill A. Korinskiy <catap@xxxxxxxx>
| | |*|  proud (maniac)? (developer|hacker)
|*|*|*|  http://catap.ru/ - +7 (916) 3-604-704 - xmpp:catap@xxxxxxxx

Attachment: pgpZ3iBCbliV8.pgp
Description: PGP signature



 




Copyright © Lexa Software, 1996-2009.