

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
17 messages in ru.sysoev.nginxRe: Is it possible to monitor the fai...| From | Sent On | Attachments |
|---|---|---|
| Robbie Allen | Jun 27, 2008 5:22 pm | |
| Alexander Staubo | Jun 27, 2008 5:39 pm | |
| Robbie Allen | Jun 27, 2008 6:08 pm | |
| Rt Ibmer | Jun 27, 2008 6:54 pm | |
| mike | Jun 27, 2008 11:02 pm | |
| Grzegorz Nosek | Jun 28, 2008 4:50 am | |
| Grzegorz Nosek | Jun 28, 2008 5:31 am | |
| mike | Jun 28, 2008 9:14 am | |
| Alexander Staubo | Jun 28, 2008 12:28 pm | |
| Grzegorz Nosek | Jun 28, 2008 12:53 pm | |
| Almir Karic | Jun 28, 2008 1:30 pm | |
| Brice Figureau | Jun 28, 2008 2:36 pm | |
| Alexander Staubo | Jun 28, 2008 4:02 pm | |
| Rt Ibmer | Jun 28, 2008 9:38 pm | |
| Grzegorz Nosek | Jun 29, 2008 10:57 am | .patch, .patch, .patch |
| Brice Figureau | Jun 30, 2008 12:23 pm | |
| Grzegorz Nosek | Jun 30, 2008 12:49 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: Is it possible to monitor the fair proxy balancer? | Actions... |
|---|---|---|
| From: | Grzegorz Nosek (grze...@public.gmane.org) | |
| Date: | Jun 29, 2008 10:57:20 am | |
| List: | ru.sysoev.nginx | |
| Attachments: | ||
Hi,
On sob, cze 28, 2008 at 11:36:51 +0200, Brice Figureau wrote:
I think we could all (I mean mainly module authors) benefits from an nginx API (like the configuration system) to declare centrally counters/variables of each module that in turn could be displayed by the status module. If I have some spare time soon, I'll try to produce an nginx patch to implement this.
I have attached an experimental patchset for pluggable status reports for nginx HTTP modules plus initial upstream_fair support.
The patchset is rather ugly because it requires adding a field to every HTTP module definition, thus breaking 3rd party modules. However, the required changes are trivial (as you can see in the patch).
I considered adding support for all modules (not only HTTP ones) and changing the ngx_module_t structure instead (which has some room to spare and would only require a few macro changes) but I think it's up to Igor to decide.
Please have a look and let me know what you think.
Best regards, Grzegorz Nosek
From a7cfcfa92cee95a9bf1395027c4d0afcc46b7513 Mon Sep 17 00:00:00 2001 From: Grzegorz Nosek <root...@public.gmane.org> Date: Sun, 29 Jun 2008 19:39:41 +0200 Subject: --with-extended-status support, part 1 - the API change
This commit does nothing useful but changes the definition of all HTTP modules to include (optional) ->report_status hook. It will be used later by the stub status module to append per-module status reports to the default status message.
--- auto/options | 2 ++ configure | 4 ++++ src/http/modules/ngx_http_access_module.c | 4 +++- src/http/modules/ngx_http_addition_filter_module.c | 4 +++- src/http/modules/ngx_http_auth_basic_module.c | 4 +++- src/http/modules/ngx_http_autoindex_module.c | 4 +++- src/http/modules/ngx_http_browser_module.c | 4 +++- src/http/modules/ngx_http_charset_filter_module.c | 4 +++- src/http/modules/ngx_http_chunked_filter_module.c | 4 +++- src/http/modules/ngx_http_dav_module.c | 4 +++- src/http/modules/ngx_http_empty_gif_module.c | 4 +++- src/http/modules/ngx_http_fastcgi_module.c | 4 +++- src/http/modules/ngx_http_flv_module.c | 4 +++- src/http/modules/ngx_http_geo_module.c | 4 +++- src/http/modules/ngx_http_gzip_filter_module.c | 4 +++- src/http/modules/ngx_http_gzip_static_module.c | 4 +++- src/http/modules/ngx_http_headers_filter_module.c | 4 +++- src/http/modules/ngx_http_index_module.c | 4 +++- src/http/modules/ngx_http_limit_zone_module.c | 4 +++- src/http/modules/ngx_http_log_module.c | 4 +++- src/http/modules/ngx_http_map_module.c | 4 +++- src/http/modules/ngx_http_memcached_module.c | 4 +++- .../modules/ngx_http_not_modified_filter_module.c | 4 +++- src/http/modules/ngx_http_proxy_module.c | 4 +++- src/http/modules/ngx_http_range_filter_module.c | 4 ++++ src/http/modules/ngx_http_realip_module.c | 4 +++- src/http/modules/ngx_http_referer_module.c | 4 +++- src/http/modules/ngx_http_rewrite_module.c | 4 +++- src/http/modules/ngx_http_ssi_filter_module.c | 4 +++- src/http/modules/ngx_http_ssl_module.c | 4 +++- src/http/modules/ngx_http_static_module.c | 4 +++- src/http/modules/ngx_http_stub_status_module.c | 4 +++- src/http/modules/ngx_http_sub_filter_module.c | 4 +++- .../modules/ngx_http_upstream_ip_hash_module.c | 4 +++- src/http/modules/ngx_http_userid_filter_module.c | 4 +++- src/http/modules/perl/ngx_http_perl_module.c | 4 +++- src/http/ngx_http_config.h | 9 +++++++++ src/http/ngx_http_copy_filter_module.c | 4 +++- src/http/ngx_http_core_module.c | 4 +++- src/http/ngx_http_header_filter_module.c | 2 ++ src/http/ngx_http_postpone_filter_module.c | 4 +++- src/http/ngx_http_upstream.c | 4 +++- src/http/ngx_http_write_filter_module.c | 2 ++ 43 files changed, 134 insertions(+), 37 deletions(-)
diff --git a/auto/options b/auto/options index e00bf97..cd4046f 100644 --- a/auto/options +++ b/auto/options @@ -81,6 +81,7 @@ HTTP_UPSTREAM_IP_HASH=YES
# STUB HTTP_STUB_STATUS=NO +HTTP_EXTENDED_STATUS=NO
MAIL=NO MAIL_SSL=NO @@ -193,6 +194,7 @@ do
# STUB --with-http_stub_status_module) HTTP_STUB_STATUS=YES ;; + --with-http-extended-status) HTTP_EXTENDED_STATUS=YES ;;
--with-mail) MAIL=YES ;; --with-mail_ssl_module) MAIL_SSL=YES ;; diff --git a/configure b/configure index 00a7f48..672b46d 100755 --- a/configure +++ b/configure @@ -51,6 +51,10 @@ if [ "$NGX_PLATFORM" != win32 ]; then . auto/threads fi
+if [ $HTTP_EXTENDED_STATUS = YES ]; then + have=NGX_HTTP_EXTENDED_STATUS . auto/have +fi + . auto/modules . auto/lib/conf
diff --git a/src/http/modules/ngx_http_access_module.c
b/src/http/modules/ngx_http_access_module.c
index 264423b..981cc57 100644
--- a/src/http/modules/ngx_http_access_module.c
+++ b/src/http/modules/ngx_http_access_module.c
@@ -66,7 +66,9 @@ static ngx_http_module_t ngx_http_access_module_ctx = {
NULL, /* merge server configuration */
ngx_http_access_create_loc_conf, /* create location configuration */ - ngx_http_access_merge_loc_conf /* merge location configuration */ + ngx_http_access_merge_loc_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_addition_filter_module.c
b/src/http/modules/ngx_http_addition_filter_module.c
index 9480082..d50b52f 100644
--- a/src/http/modules/ngx_http_addition_filter_module.c
+++ b/src/http/modules/ngx_http_addition_filter_module.c
@@ -57,7 +57,9 @@ static ngx_http_module_t ngx_http_addition_filter_module_ctx
= {
NULL, /* merge server configuration */
ngx_http_addition_create_conf, /* create location configuration */ - ngx_http_addition_merge_conf /* merge location configuration */ + ngx_http_addition_merge_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_auth_basic_module.c
b/src/http/modules/ngx_http_auth_basic_module.c
index 41e53cd..ffdb3b1 100644
--- a/src/http/modules/ngx_http_auth_basic_module.c
+++ b/src/http/modules/ngx_http_auth_basic_module.c
@@ -71,7 +71,9 @@ static ngx_http_module_t ngx_http_auth_basic_module_ctx = {
NULL, /* merge server configuration */
ngx_http_auth_basic_create_loc_conf, /* create location configuration */ - ngx_http_auth_basic_merge_loc_conf /* merge location configuration */ + ngx_http_auth_basic_merge_loc_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_autoindex_module.c
b/src/http/modules/ngx_http_autoindex_module.c
index f57fbc8..065963b 100644
--- a/src/http/modules/ngx_http_autoindex_module.c
+++ b/src/http/modules/ngx_http_autoindex_module.c
@@ -92,7 +92,9 @@ static ngx_http_module_t ngx_http_autoindex_module_ctx = {
NULL, /* merge server configuration */
ngx_http_autoindex_create_loc_conf, /* create location configration */ - ngx_http_autoindex_merge_loc_conf /* merge location configration */ + ngx_http_autoindex_merge_loc_conf, /* merge location configration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_browser_module.c
b/src/http/modules/ngx_http_browser_module.c
index 083375b..6d5f117 100644
--- a/src/http/modules/ngx_http_browser_module.c
+++ b/src/http/modules/ngx_http_browser_module.c
@@ -123,7 +123,9 @@ static ngx_http_module_t ngx_http_browser_module_ctx = {
NULL, /* merge server configuration */
ngx_http_browser_create_conf, /* create location configuration */ - ngx_http_browser_merge_conf /* merge location configuration */ + ngx_http_browser_merge_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_charset_filter_module.c
b/src/http/modules/ngx_http_charset_filter_module.c
index 850e64e..6d0fb8c 100644
--- a/src/http/modules/ngx_http_charset_filter_module.c
+++ b/src/http/modules/ngx_http_charset_filter_module.c
@@ -158,7 +158,9 @@ static ngx_http_module_t ngx_http_charset_filter_module_ctx
= {
NULL, /* merge server configuration */
ngx_http_charset_create_loc_conf, /* create location configuration */ - ngx_http_charset_merge_loc_conf /* merge location configuration */ + ngx_http_charset_merge_loc_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_chunked_filter_module.c
b/src/http/modules/ngx_http_chunked_filter_module.c
index 3cc20eb..cec3082 100644
--- a/src/http/modules/ngx_http_chunked_filter_module.c
+++ b/src/http/modules/ngx_http_chunked_filter_module.c
@@ -23,7 +23,9 @@ static ngx_http_module_t ngx_http_chunked_filter_module_ctx =
{
NULL, /* merge server configuration */
NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_dav_module.c
b/src/http/modules/ngx_http_dav_module.c
index b1e0831..83a1916 100644
--- a/src/http/modules/ngx_http_dav_module.c
+++ b/src/http/modules/ngx_http_dav_module.c
@@ -122,7 +122,9 @@ static ngx_http_module_t ngx_http_dav_module_ctx = {
NULL, /* merge server configuration */
ngx_http_dav_create_loc_conf, /* create location configuration */ - ngx_http_dav_merge_loc_conf /* merge location configuration */ + ngx_http_dav_merge_loc_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_empty_gif_module.c
b/src/http/modules/ngx_http_empty_gif_module.c
index 8450cae..8805ae4 100644
--- a/src/http/modules/ngx_http_empty_gif_module.c
+++ b/src/http/modules/ngx_http_empty_gif_module.c
@@ -85,7 +85,9 @@ static ngx_http_module_t ngx_http_empty_gif_module_ctx = {
NULL, /* merge server configuration */
NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_fastcgi_module.c
b/src/http/modules/ngx_http_fastcgi_module.c
index 17e8a3d..5fb86ab 100644
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -365,7 +365,9 @@ static ngx_http_module_t ngx_http_fastcgi_module_ctx = {
NULL, /* merge server configuration */
ngx_http_fastcgi_create_loc_conf, /* create location configuration */ - ngx_http_fastcgi_merge_loc_conf /* merge location configuration */ + ngx_http_fastcgi_merge_loc_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_flv_module.c
b/src/http/modules/ngx_http_flv_module.c
index 0e19091..0247097 100644
--- a/src/http/modules/ngx_http_flv_module.c
+++ b/src/http/modules/ngx_http_flv_module.c
@@ -37,7 +37,9 @@ static ngx_http_module_t ngx_http_flv_module_ctx = {
NULL, /* merge server configuration */
NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_geo_module.c
b/src/http/modules/ngx_http_geo_module.c
index 37be887..22be83f 100644
--- a/src/http/modules/ngx_http_geo_module.c
+++ b/src/http/modules/ngx_http_geo_module.c
@@ -44,7 +44,9 @@ static ngx_http_module_t ngx_http_geo_module_ctx = {
NULL, /* merge server configuration */
NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_gzip_filter_module.c
b/src/http/modules/ngx_http_gzip_filter_module.c
index 1587c00..41f3d1d 100644
--- a/src/http/modules/ngx_http_gzip_filter_module.c
+++ b/src/http/modules/ngx_http_gzip_filter_module.c
@@ -156,7 +156,9 @@ static ngx_http_module_t ngx_http_gzip_filter_module_ctx =
{
NULL, /* merge server configuration */
ngx_http_gzip_create_conf, /* create location configuration */ - ngx_http_gzip_merge_conf /* merge location configuration */ + ngx_http_gzip_merge_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_gzip_static_module.c
b/src/http/modules/ngx_http_gzip_static_module.c
index c373649..e92b7a0 100644
--- a/src/http/modules/ngx_http_gzip_static_module.c
+++ b/src/http/modules/ngx_http_gzip_static_module.c
@@ -45,7 +45,9 @@ ngx_http_module_t ngx_http_gzip_static_module_ctx = {
NULL, /* merge server configuration */
ngx_http_gzip_static_create_conf, /* create location configuration */ - ngx_http_gzip_static_merge_conf /* merge location configuration */ + ngx_http_gzip_static_merge_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_headers_filter_module.c
b/src/http/modules/ngx_http_headers_filter_module.c
index 06c91bc..cfa5835 100644
--- a/src/http/modules/ngx_http_headers_filter_module.c
+++ b/src/http/modules/ngx_http_headers_filter_module.c
@@ -105,7 +105,9 @@ static ngx_http_module_t ngx_http_headers_filter_module_ctx
= {
NULL, /* merge server configuration */
ngx_http_headers_create_conf, /* create location configuration */ - ngx_http_headers_merge_conf /* merge location configuration */ + ngx_http_headers_merge_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_index_module.c
b/src/http/modules/ngx_http_index_module.c
index 6bfb045..be3b063 100644
--- a/src/http/modules/ngx_http_index_module.c
+++ b/src/http/modules/ngx_http_index_module.c
@@ -62,7 +62,9 @@ static ngx_http_module_t ngx_http_index_module_ctx = {
NULL, /* merge server configuration */
ngx_http_index_create_loc_conf, /* create location configration */ - ngx_http_index_merge_loc_conf /* merge location configration */ + ngx_http_index_merge_loc_conf, /* merge location configration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_limit_zone_module.c
b/src/http/modules/ngx_http_limit_zone_module.c
index c7a3753..3b9e424 100644
--- a/src/http/modules/ngx_http_limit_zone_module.c
+++ b/src/http/modules/ngx_http_limit_zone_module.c
@@ -79,7 +79,9 @@ static ngx_http_module_t ngx_http_limit_zone_module_ctx = {
NULL, /* merge server configuration */
ngx_http_limit_zone_create_conf, /* create location configration */ - ngx_http_limit_zone_merge_conf /* merge location configration */ + ngx_http_limit_zone_merge_conf, /* merge location configration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_log_module.c
b/src/http/modules/ngx_http_log_module.c
index 157b15c..fa538d0 100644
--- a/src/http/modules/ngx_http_log_module.c
+++ b/src/http/modules/ngx_http_log_module.c
@@ -135,7 +135,9 @@ static ngx_http_module_t ngx_http_log_module_ctx = {
NULL, /* merge server configuration */
ngx_http_log_create_loc_conf, /* create location configration */ - ngx_http_log_merge_loc_conf /* merge location configration */ + ngx_http_log_merge_loc_conf, /* merge location configration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_map_module.c
b/src/http/modules/ngx_http_map_module.c
index c1d87c1..1eda16f 100644
--- a/src/http/modules/ngx_http_map_module.c
+++ b/src/http/modules/ngx_http_map_module.c
@@ -78,7 +78,9 @@ static ngx_http_module_t ngx_http_map_module_ctx = {
NULL, /* merge server configuration */
NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_memcached_module.c
b/src/http/modules/ngx_http_memcached_module.c
index 64592f3..4fc8000 100644
--- a/src/http/modules/ngx_http_memcached_module.c
+++ b/src/http/modules/ngx_http_memcached_module.c
@@ -128,7 +128,9 @@ static ngx_http_module_t ngx_http_memcached_module_ctx = {
NULL, /* merge server configuration */
ngx_http_memcached_create_loc_conf, /* create location configration */ - ngx_http_memcached_merge_loc_conf /* merge location configration */ + ngx_http_memcached_merge_loc_conf, /* merge location configration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_not_modified_filter_module.c
b/src/http/modules/ngx_http_not_modified_filter_module.c
index ce4b55c..6d4205e 100644
--- a/src/http/modules/ngx_http_not_modified_filter_module.c
+++ b/src/http/modules/ngx_http_not_modified_filter_module.c
@@ -24,7 +24,9 @@ static ngx_http_module_t
ngx_http_not_modified_filter_module_ctx = {
NULL, /* merge server configuration */
NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_proxy_module.c
b/src/http/modules/ngx_http_proxy_module.c
index c559d31..75bbe2a 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -397,7 +397,9 @@ static ngx_http_module_t ngx_http_proxy_module_ctx = {
NULL, /* merge server configuration */
ngx_http_proxy_create_loc_conf, /* create location configration */ - ngx_http_proxy_merge_loc_conf /* merge location configration */ + ngx_http_proxy_merge_loc_conf, /* merge location configration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_range_filter_module.c
b/src/http/modules/ngx_http_range_filter_module.c
index cf42daf..122891c 100644
--- a/src/http/modules/ngx_http_range_filter_module.c
+++ b/src/http/modules/ngx_http_range_filter_module.c
@@ -74,6 +74,8 @@ static ngx_http_module_t
ngx_http_range_header_filter_module_ctx = {
NULL, /* create location configuration */ NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
@@ -105,6 +107,8 @@ static ngx_http_module_t
ngx_http_range_body_filter_module_ctx = {
NULL, /* create location configuration */ NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_realip_module.c
b/src/http/modules/ngx_http_realip_module.c
index 4de4c13..7f2b66c 100644
--- a/src/http/modules/ngx_http_realip_module.c
+++ b/src/http/modules/ngx_http_realip_module.c
@@ -72,7 +72,9 @@ static ngx_http_module_t ngx_http_realip_module_ctx = {
NULL, /* merge server configuration */
ngx_http_realip_create_loc_conf, /* create location configuration */ - ngx_http_realip_merge_loc_conf /* merge location configuration */ + ngx_http_realip_merge_loc_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_referer_module.c
b/src/http/modules/ngx_http_referer_module.c
index 0582899..4f039a8 100644
--- a/src/http/modules/ngx_http_referer_module.c
+++ b/src/http/modules/ngx_http_referer_module.c
@@ -69,7 +69,9 @@ static ngx_http_module_t ngx_http_referer_module_ctx = {
NULL, /* merge server configuration */
ngx_http_referer_create_conf, /* create location configuration */ - ngx_http_referer_merge_conf /* merge location configuration */ + ngx_http_referer_merge_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_rewrite_module.c
b/src/http/modules/ngx_http_rewrite_module.c
index 341e054..8663827 100644
--- a/src/http/modules/ngx_http_rewrite_module.c
+++ b/src/http/modules/ngx_http_rewrite_module.c
@@ -113,7 +113,9 @@ static ngx_http_module_t ngx_http_rewrite_module_ctx = {
NULL, /* merge server configuration */
ngx_http_rewrite_create_loc_conf, /* create location configration */ - ngx_http_rewrite_merge_loc_conf /* merge location configration */ + ngx_http_rewrite_merge_loc_conf, /* merge location configration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_ssi_filter_module.c
b/src/http/modules/ngx_http_ssi_filter_module.c
index 1d7730d..e0c957f 100644
--- a/src/http/modules/ngx_http_ssi_filter_module.c
+++ b/src/http/modules/ngx_http_ssi_filter_module.c
@@ -174,7 +174,9 @@ static ngx_http_module_t ngx_http_ssi_filter_module_ctx = {
NULL, /* merge server configuration */
ngx_http_ssi_create_loc_conf, /* create location configuration */ - ngx_http_ssi_merge_loc_conf /* merge location configuration */ + ngx_http_ssi_merge_loc_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_ssl_module.c
b/src/http/modules/ngx_http_ssl_module.c
index 3359900..805a703 100644
--- a/src/http/modules/ngx_http_ssl_module.c
+++ b/src/http/modules/ngx_http_ssl_module.c
@@ -147,7 +147,9 @@ static ngx_http_module_t ngx_http_ssl_module_ctx = {
ngx_http_ssl_merge_srv_conf, /* merge server configuration */
NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_static_module.c
b/src/http/modules/ngx_http_static_module.c
index c4e688f..536eae7 100644
--- a/src/http/modules/ngx_http_static_module.c
+++ b/src/http/modules/ngx_http_static_module.c
@@ -24,7 +24,9 @@ ngx_http_module_t ngx_http_static_module_ctx = {
NULL, /* merge server configuration */
NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_stub_status_module.c
b/src/http/modules/ngx_http_stub_status_module.c
index 9d2d074..cc1fd51 100644
--- a/src/http/modules/ngx_http_stub_status_module.c
+++ b/src/http/modules/ngx_http_stub_status_module.c
@@ -37,7 +37,9 @@ static ngx_http_module_t ngx_http_stub_status_module_ctx = {
NULL, /* merge server configuration */
NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_sub_filter_module.c
b/src/http/modules/ngx_http_sub_filter_module.c
index 663a9f5..8575347 100644
--- a/src/http/modules/ngx_http_sub_filter_module.c
+++ b/src/http/modules/ngx_http_sub_filter_module.c
@@ -105,7 +105,9 @@ static ngx_http_module_t ngx_http_sub_filter_module_ctx = {
NULL, /* merge server configuration */
ngx_http_sub_create_conf, /* create location configuration */ - ngx_http_sub_merge_conf /* merge location configuration */ + ngx_http_sub_merge_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c
b/src/http/modules/ngx_http_upstream_ip_hash_module.c
index 1d13481..7c61584 100644
--- a/src/http/modules/ngx_http_upstream_ip_hash_module.c
+++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c
@@ -56,7 +56,9 @@ static ngx_http_module_t ngx_http_upstream_ip_hash_module_ctx
= {
NULL, /* merge server configuration */
NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/ngx_http_userid_filter_module.c
b/src/http/modules/ngx_http_userid_filter_module.c
index 98cff7e..5980bf3 100644
--- a/src/http/modules/ngx_http_userid_filter_module.c
+++ b/src/http/modules/ngx_http_userid_filter_module.c
@@ -164,7 +164,9 @@ static ngx_http_module_t ngx_http_userid_filter_module_ctx
= {
NULL, /* merge server configuration */
ngx_http_userid_create_conf, /* create location configration */ - ngx_http_userid_merge_conf /* merge location configration */ + ngx_http_userid_merge_conf, /* merge location configration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/modules/perl/ngx_http_perl_module.c
b/src/http/modules/perl/ngx_http_perl_module.c
index ab89cad..b6af377 100644
--- a/src/http/modules/perl/ngx_http_perl_module.c
+++ b/src/http/modules/perl/ngx_http_perl_module.c
@@ -115,7 +115,9 @@ static ngx_http_module_t ngx_http_perl_module_ctx = {
NULL, /* merge server configuration */
ngx_http_perl_create_loc_conf, /* create location configuration */ - ngx_http_perl_merge_loc_conf /* merge location configuration */ + ngx_http_perl_merge_loc_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/ngx_http_config.h b/src/http/ngx_http_config.h index 6629210..b4e7460 100644 --- a/src/http/ngx_http_config.h +++ b/src/http/ngx_http_config.h @@ -32,8 +32,17 @@ typedef struct {
void *(*create_loc_conf)(ngx_conf_t *cf); char *(*merge_loc_conf)(ngx_conf_t *cf, void *prev, void *conf); + +#if (NGX_HTTP_EXTENDED_STATUS) + ngx_chain_t *(*report_status)(ngx_http_request_t *r, ngx_int_t *length); +#endif } ngx_http_module_t;
+#if (NGX_HTTP_EXTENDED_STATUS) +#define NGX_HTTP_NULL_STATUS NULL +#else +#define NGX_HTTP_NULL_STATUS +#endif
#define NGX_HTTP_MODULE 0x50545448 /* "HTTP" */
diff --git a/src/http/ngx_http_copy_filter_module.c
b/src/http/ngx_http_copy_filter_module.c
index 3b1a3a7..00abccf 100644
--- a/src/http/ngx_http_copy_filter_module.c
+++ b/src/http/ngx_http_copy_filter_module.c
@@ -44,7 +44,9 @@ static ngx_http_module_t ngx_http_copy_filter_module_ctx = {
NULL, /* merge server configuration */
ngx_http_copy_filter_create_conf, /* create location configuration */ - ngx_http_copy_filter_merge_conf /* merge location configuration */ + ngx_http_copy_filter_merge_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index f57db36..5e49b8a 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -633,7 +633,9 @@ static ngx_http_module_t ngx_http_core_module_ctx = { ngx_http_core_merge_srv_conf, /* merge server configuration */
ngx_http_core_create_loc_conf, /* create location configuration */ - ngx_http_core_merge_loc_conf /* merge location configuration */ + ngx_http_core_merge_loc_conf, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/ngx_http_header_filter_module.c
b/src/http/ngx_http_header_filter_module.c
index 9cdac61..04c397b 100644
--- a/src/http/ngx_http_header_filter_module.c
+++ b/src/http/ngx_http_header_filter_module.c
@@ -26,6 +26,8 @@ static ngx_http_module_t ngx_http_header_filter_module_ctx =
{
NULL, /* create location configuration */ NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/ngx_http_postpone_filter_module.c
b/src/http/ngx_http_postpone_filter_module.c
index 3262166..5d712f8 100644
--- a/src/http/ngx_http_postpone_filter_module.c
+++ b/src/http/ngx_http_postpone_filter_module.c
@@ -25,7 +25,9 @@ static ngx_http_module_t ngx_http_postpone_filter_module_ctx
= {
NULL, /* merge server configuration */
NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 9ec861c..1c18213 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -246,7 +246,9 @@ static ngx_http_module_t ngx_http_upstream_module_ctx = { NULL, /* merge server configuration */
NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
diff --git a/src/http/ngx_http_write_filter_module.c
b/src/http/ngx_http_write_filter_module.c
index bc62b18..a0b3ccd 100644
--- a/src/http/ngx_http_write_filter_module.c
+++ b/src/http/ngx_http_write_filter_module.c
@@ -25,6 +25,8 @@ static ngx_http_module_t ngx_http_write_filter_module_ctx = {
NULL, /* create location configuration */ NULL, /* merge location configuration */ + + NGX_HTTP_NULL_STATUS };
-- 1.5.4.4
From cb9c3f739485f29dae9a21a8ff0fc3bb8c785148 Mon Sep 17 00:00:00 2001 From: Grzegorz Nosek <root...@public.gmane.org> Date: Sun, 29 Jun 2008 19:42:21 +0200 Subject: Support extended status reports in stub_status module
--- src/http/modules/ngx_http_stub_status_module.c | 38 ++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/src/http/modules/ngx_http_stub_status_module.c
b/src/http/modules/ngx_http_stub_status_module.c
index cc1fd51..d163ab7 100644
--- a/src/http/modules/ngx_http_stub_status_module.c
+++ b/src/http/modules/ngx_http_stub_status_module.c
@@ -66,6 +66,11 @@ static ngx_int_t ngx_http_status_handler(ngx_http_request_t
*r)
ngx_buf_t *b;
ngx_chain_t out;
ngx_atomic_int_t ap, hn, ac, rq, rd, wr;
+#if (NGX_HTTP_EXTENDED_STATUS)
+ ngx_int_t i;
+ ngx_chain_t *tail;
+ ngx_chain_t *mod_status;
+#endif
if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) {
return NGX_HTTP_NOT_ALLOWED;
@@ -125,6 +130,39 @@ static ngx_int_t ngx_http_status_handler(ngx_http_request_t
*r)
b->last_buf = 1;
+#if (NGX_HTTP_EXTENDED_STATUS) + tail = &out; + + for (i=0; ngx_modules[i]; i++) { + ngx_http_module_t *ctx; + ngx_int_t length; + + if (ngx_modules[i]->type != NGX_HTTP_MODULE) { + continue; + } + + ctx = (ngx_http_module_t *) ngx_modules[i]->ctx; + if (!ctx || !ctx->report_status) { + continue; + } + + length = 0; + mod_status = ctx->report_status(r, &length); + if (mod_status) { + tail->next = mod_status; + tail->buf->last_buf = 0; + + tail = mod_status; + + if (!length) { + length = mod_status->buf->last - mod_status->buf->pos; + } + + r->headers_out.content_length_n += length; + } + } +#endif + rc = ngx_http_send_header(r);
if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
-- 1.5.4.4
From 6a126f9ea8fb74733ab52b68dff21f26c7367673 Mon Sep 17 00:00:00 2001 From: Grzegorz Nosek <root...@public.gmane.org> Date: Sun, 29 Jun 2008 19:43:36 +0200 Subject: --with-extended-status support in upstream_fair
The data returned is more for debugging purposes than real production monitoring, so this is still proof-of-concept stage.
--- ngx_http_upstream_fair_module.c | 121 ++++++++++++++++++++++++++++++++++++++- 1 files changed, 120 insertions(+), 1 deletions(-)
diff --git a/ngx_http_upstream_fair_module.c b/ngx_http_upstream_fair_module.c
index 5286396..8099fd2 100644
--- a/ngx_http_upstream_fair_module.c
+++ b/ngx_http_upstream_fair_module.c
@@ -86,6 +86,11 @@ static char *ngx_http_upstream_fair(ngx_conf_t *cf,
ngx_command_t *cmd,
static char *ngx_http_upstream_fair_set_shm_size(ngx_conf_t *cf,
ngx_command_t *cmd, void *conf);
+#if (NGX_HTTP_EXTENDED_STATUS)
+static ngx_chain_t *ngx_http_upstream_fair_report_status(ngx_http_request_t *r,
+ ngx_int_t *length);
+#endif
+
#if (NGX_HTTP_SSL)
static ngx_int_t ngx_http_upstream_fair_set_session(ngx_peer_connection_t *pc,
void *data);
@@ -124,7 +129,11 @@ static ngx_http_module_t ngx_http_upstream_fair_module_ctx
= {
NULL, /* merge server configuration */
NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL, /* merge location configuration */ + +#if (NGX_HTTP_EXTENDED_STATUS) + ngx_http_upstream_fair_report_status, +#endif };
@@ -1076,4 +1085,114 @@
ngx_http_upstream_fair_save_session(ngx_peer_connection_t *pc, void *data)
}
#endif
+
+#if (NGX_HTTP_EXTENDED_STATUS)
+static void
+ngx_http_upstream_fair_walk_status(ngx_pool_t *pool, ngx_chain_t *cl, ngx_int_t
*length,
+ ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel)
+{
+ ngx_http_upstream_fair_shm_block_t *s_node =
(ngx_http_upstream_fair_shm_block_t *) node;
+ ngx_http_upstream_fair_peers_t *peers;
+ ngx_chain_t *new_cl;
+ ngx_buf_t *b;
+ ngx_uint_t size, i;
+
+ if (node == sentinel) {
+ return;
+ }
+
+ if (node->left != sentinel) {
+ ngx_http_upstream_fair_walk_status(pool, cl, length, node->left,
sentinel);
+ }
+
+ size = 200 + s_node->peers->number * 120; /* LOTS of slack */
+
+ b = ngx_create_temp_buf(pool, size);
+ if (!b) {
+ goto next;
+ }
+
+ new_cl = ngx_alloc_chain_link(pool);
+ if (!new_cl) {
+ goto next;
+ }
+
+ new_cl->buf = b;
+ new_cl->next = NULL;
+ cl->next = new_cl;
+
+ peers = s_node->peers;
+
+ b->last = ngx_sprintf(b->last, "upstream %V (%p): current peer %d/%d\n",
peers->name, (void*) node, peers->current, peers->number);
+ for (i = 0; i < peers->number; i++) {
+ ngx_http_upstream_fair_peer_t *peer = &peers->peer[i];
+ ngx_http_upstream_fair_shared_t *sh = peer->shared;
+ b->last = ngx_sprintf(b->last, " peer %d: %V weight: %d/%d, fails:
%d/%d, acc: %d, down: %d, nreq: %d, last_act: %ui\n",
+ i, &peer->name, sh->current_weight, peer->weight, sh->fails,
peer->max_fails, peer->accessed, peer->down,
+ sh->nreq, sh->last_active);
+ }
+ b->last = ngx_sprintf(b->last, "\n");
+ b->last_buf = 1;
+
+ *length += b->last - b->pos;
+
+ if (cl->buf) {
+ cl->buf->last_buf = 0;
+ }
+
+next:
+
+ if (node->right != sentinel) {
+ ngx_http_upstream_fair_walk_status(pool, cl, length, node->right,
sentinel);
+ }
+}
+
+static ngx_chain_t*
+ngx_http_upstream_fair_report_status(ngx_http_request_t *r, ngx_int_t *length)
+{
+ ngx_buf_t *b;
+ ngx_chain_t *cl, *tree_cl;
+ ngx_slab_pool_t *shpool;
+
+ b = ngx_create_temp_buf(r->pool, sizeof("\nupstream_fair status
report:\n"));
+ if (!b) {
+ return NULL;
+ }
+
+ cl = ngx_alloc_chain_link(r->pool);
+ tree_cl = ngx_alloc_chain_link(r->pool);
+ if (!cl || !tree_cl) {
+ return NULL;
+ }
+ cl->next = tree_cl;
+ cl->buf = b;
+
+ tree_cl->next = NULL;
+ tree_cl->buf = NULL;
+
+ b->last = ngx_cpymem(b->last, "\nupstream_fair status report:\n",
+ sizeof("\nupstream_fair status report:\n") - 1);
+
+ *length = b->last - b->pos;
+
+ shpool = (ngx_slab_pool_t *)ngx_http_upstream_fair_shm_zone->shm.addr;
+
+ ngx_shmtx_lock(&shpool->mutex);
+
+ ngx_http_upstream_fair_walk_status(r->pool, cl,
+ length,
+ ngx_http_upstream_fair_rbtree->root,
+ ngx_http_upstream_fair_rbtree->sentinel);
+
+ ngx_shmtx_unlock(&shpool->mutex);
+
+ if (!cl->next->buf) {
+ /* no upstream_fair status to report */
+ return NULL;
+ }
+
+ return cl;
+}
+#endif
+
/* vim: set et ts=4 sw=4: */
-- 1.5.4.4








.patch, .patch, .patch