Giter VIP home page Giter VIP logo

nginx-module-stream-sts's People

Contributors

catbro666 avatar vozlt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nginx-module-stream-sts's Issues

configuration error

i have already clone sts and sts-stream-module(save at /usr/local) , and configre like this :
./configure --without-pcre
--prefix=/usr/local/nginx
--with-debug
--without-http_rewrite_module
--with-poll_module
--with-http_stub_status_module
--add-module=/usr/local/nginx-module-sts
--add-module=/usr/local/nginx-module-stream-sts

and error like this :
adding module in /usr/local/nginx-module-sts
./configure: 2: .: Can't open auto/have

so where is the problem? thx

transparently fails to work

Hi,

I have successfully compiled a binary with these modules:
$ ./nginx -V
nginx version: nginx/1.15.12
built by clang 10.0.1 (clang-1001.0.46.4)
configure arguments: --with-stream --add-module=./nginx-module-sts --add-module=./nginx-module-stream-sts

conf file:
events { }

error_log /tmp/error.log debug;

http {
server {
listen 127.0.0.1:1937;

            location /status {
             stream_server_traffic_status_display;
             stream_server_traffic_status_display_format html;
            }
    }

}

stream {

    server_traffic_status_zone;

    upstream some_backend {
            least_conn;
            server localhost:21110;
            server localhost:21111;
            server localhost:21112;
    }

    server {
            listen 10000;
            proxy_pass storescp_backend;
            proxy_timeout 5s;
            proxy_connect_timeout 1s;
    }

}

however, when I try to GET any of the endpoints, I get a 501:

$ wget http://localhost:1937/status/format/html
--2019-05-05 11:41:23-- http://localhost:1937/status/format/html
Resolving localhost (localhost)... 127.0.0.1, ::1
Connecting to localhost (localhost)|127.0.0.1|:1937... connected.
HTTP request sent, awaiting response... 501 Not Implemented
2019-05-05 11:41:23 ERROR 501: Not Implemented.

unfortunately there is no error in the logs either.

please advise

display_handler::shm_init() failed

OS: CentOS 6.9

Nginx info:

  • 1.12.0
  • build with dynamic module
    • /usr/lib64/nginx/ngx_http_stream_server_traffic_status_module.so
    • /usr/lib64/nginx/ngx_stream_server_traffic_status_module.so
      --add-dynamic-module=nginx-module-sts-0.1.0 --add-dynamic-module=nginx-module-stream-sts-0.1.0
  • order of load module
    • check 3 case and get same results.
load_module "/usr/lib64/nginx/ngx_stream_module.so";
load_module "/usr/lib64/nginx/ngx_stream_server_traffic_status_module.so";
load_module "/usr/lib64/nginx/ngx_http_stream_server_traffic_status_module.so";

or

load_module "/usr/lib64/nginx/ngx_stream_module.so";
load_module "/usr/lib64/nginx/ngx_stream_server_traffic_status_module.so";
load_module "/usr/lib64/nginx/ngx_http_stream_server_traffic_status_module.so";

or

load_module "/usr/lib64/nginx/ngx_http_stream_server_traffic_status_module.so";

nginx-module-stream-sts : 0.1.0 release version

nginx config:

load_module "/usr/lib64/nginx/ngx_http_geoip_module.so";
#load_module "/usr/lib64/nginx/ngx_http_image_filter_module.so";
#load_module "/usr/lib64/nginx/ngx_http_perl_module.so";
load_module "/usr/lib64/nginx/ngx_http_stream_server_traffic_status_module.so";
#load_module "/usr/lib64/nginx/ngx_http_vhost_traffic_status_module.so";
#load_module "/usr/lib64/nginx/ngx_http_xslt_filter_module.so";
#load_module "/usr/lib64/nginx/ngx_mail_module.so";
#load_module "/usr/lib64/nginx/ngx_stream_module.so";
#load_module "/usr/lib64/nginx/ngx_stream_geoip_module.so";
#load_module "/usr/lib64/nginx/ngx_stream_server_traffic_status_module.so";

http {
     ...
    stream_server_traffic_status on;
    stream_server_traffic_status_zone;
    ...

    server {

        listen     80 default_server;
        server_name  _;

        location / {
            try_files     $uri $uri/ =404;
            root          /usr/share/nginx/html;
            index         index.html index.php;
        }

        location ~ ^/(robots\.txt|favicon\.ico)($|/) {
            log_not_found off;
            access_log off;
        }

        localtion /status {
            stream_server_traffic_status_display;
            stream_server_traffic_status_display_format html;
        }

        # Error documents
        location ~ /nginx-error/error.html {
            internal;
            alias /usr/share/nginx/html/error.html;

            ssi on;
            set $hstatus $args;
            access_log off;
        }

        # Fancyindex
        location /fancyindex/ {
            alias /usr/share/nginx/fancyindex/;
        }

        #
        # logging off
        #
        location = /robots.txt {
            log_not_found off;
            access_log    off;
        }

        location = /favicon.ico {
            log_not_found off;
            access_log    off;
        }

        location ~ \.(dat|cfg|orig|org|bak|rpmsave|save|,v|tpl|la?ng|modules?|engines?|install|inc|ini|ph)$ {
            deny all;
        }

        location ~ \.(htaccess|htgroup|htpasswd) {
            deny all;
        }

        location ~ /(temp|sessions?|class(es)?)/ {
            deny all;
        }
    }
}

And access http://domain.com/status, occurs follow error:

[error] 10391#0: *1 display_handler::shm_init() failed, client: 192.168.0.1, server: _, request: "GET /status HTTP/1.1", host: "domain.com"

Compile Failed

	/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c: In function 'ngx_stream_server_traffic_status_session_time':
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:184:27: error: 'ngx_stream_session_t {aka struct ngx_stream_session_s}' has no member named 'start_sec'
              ((tp->sec - s->start_sec) * 1000 + (tp->msec - s->start_msec));
                           ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:184:62: error: 'ngx_stream_session_t {aka struct ngx_stream_session_s}' has no member named 'start_msec'
              ((tp->sec - s->start_sec) * 1000 + (tp->msec - s->start_msec));
                                                              ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c: In function 'ngx_stream_server_traffic_status_upstream_response_time':
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:194:5: error: unknown type name 'ngx_stream_upstream_state_t'
     ngx_stream_upstream_state_t  *state;
     ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:198:14: error: 'ngx_stream_session_t {aka struct ngx_stream_session_s}' has no member named 'upstream_states'
     state = s->upstream_states->elts;
              ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:203:25: error: request for member 'first_byte_time' in something not a structure or union
             if (state[i].first_byte_time == (ngx_msec_t) -1) {
                         ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:207:27: error: request for member 'first_byte_time' in something not a structure or union
             ms += state[i].first_byte_time;
                           ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:209:41: error: request for member 'connect_time' in something not a structure or union
         } else if (data == 2 && state[i].connect_time != (ngx_msec_t) -1) {
                                         ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:210:27: error: request for member 'connect_time' in something not a structure or union
             ms += state[i].connect_time;
                           ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:213:27: error: request for member 'response_time' in something not a structure or union
             ms += state[i].response_time;
                           ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:218:21: error: 'ngx_stream_session_t {aka struct ngx_stream_session_s}' has no member named 'upstream_states'
         if (++i == s->upstream_states->nelts) {
                     ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c: In function 'ngx_stream_server_traffic_status_init':
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:619:29: error: 'ngx_stream_core_main_conf_t {aka struct <anonymous>}' has no member named 'phases'
     h = ngx_array_push(&cmcf->phases[NGX_STREAM_PREACCESS_PHASE].handlers);
                             ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:619:38: error: 'NGX_STREAM_PREACCESS_PHASE' undeclared (first use in this function)
     h = ngx_array_push(&cmcf->phases[NGX_STREAM_PREACCESS_PHASE].handlers);
                                      ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:619:38: note: each undeclared identifier is reported only once for each function it appears in
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:624:8: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     *h = ngx_stream_server_traffic_status_limit_handler;
        ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:626:29: error: 'ngx_stream_core_main_conf_t {aka struct <anonymous>}' has no member named 'phases'
     h = ngx_array_push(&cmcf->phases[NGX_STREAM_LOG_PHASE].handlers);
                             ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:626:38: error: 'NGX_STREAM_LOG_PHASE' undeclared (first use in this function)
     h = ngx_array_push(&cmcf->phases[NGX_STREAM_LOG_PHASE].handlers);
                                      ^
/usr/local/src/nginx-module-stream-sts-master/src/ngx_stream_server_traffic_status_module.c:631:8: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     *h = ngx_stream_server_traffic_status_handler;
        ^
objs/Makefile:2920: recipe for target 'objs/addon/src/ngx_stream_server_traffic_status_module.o' failed
make[2]: *** [objs/addon/src/ngx_stream_server_traffic_status_module.o] Error 1
make[2]: Leaving directory '/tmp/openresty-1.11.2.2/build/nginx-1.11.2'
make[1]: *** [build] Error 2
Makefile:8: recipe for target 'build' failed
make[1]: Leaving directory '/tmp/openresty-1.11.2.2/build/nginx-1.11.2'
make: *** [all] Error 2

Traffic stats for long tcp sessions

HI!

After clients connect to our TCP application the connections remain in ESTABLISHED state for rather long time (days or weeks).

When I refresh the stats page I don't see any updates before client disconnects. As I understand the stats are updated only on session termination, right ? Or probably we can somehow get traffic/session stats before that ?

Thanks!

Regards,
Sergey

Nullptr utilization

The 'p' pointer was utilized before it was verified against nullptr. Check lines: 76, 88 in ngx_stream_server_traffic_status_filter.c.
The 'p' pointer was utilized before it was verified against nullptr. Check lines: 420, 432 in ngx_stream_server_traffic_status_filter.c.

Compile failed with nginx 1.12.1

I am building it on ubuntu. Following is the config from debian/rules

full_configure_flags :=
$(common_configure_flags)
--with-http_addition_module
--with-http_geoip_module=dynamic
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_image_filter_module=dynamic
--with-http_sub_module
--with-http_xslt_module=dynamic
--with-stream=dynamic
--with-stream_ssl_module
--with-stream_ssl_preread_module
--with-mail=dynamic
--with-mail_ssl_module
--add-dynamic-module=$(MODULESDIR)/nginx-auth-pam
--add-dynamic-module=$(MODULESDIR)/nginx-dav-ext-module
--add-dynamic-module=$(MODULESDIR)/nginx-echo
--add-dynamic-module=$(MODULESDIR)/nginx-upstream-fair
--add-dynamic-module=$(MODULESDIR)/ngx_http_substitutions_filter_module
--add-module=/opt/nginx-modules/nginx-module-vts
--add-module=/opt/nginx-modules/nginx-module-sts
--add-module=/opt/nginx-modules/nginx-module-stream-sts

objs/addon/src/ngx_stream_server_traffic_status_module.o: In function ngx_stream_server_traffic_status_init_main_conf': /opt/nginx-modules/nginx-module-stream-sts/src/ngx_stream_server_traffic_status_module.c:476: undefined reference to ngx_stream_upstream_module'
objs/addon/src/ngx_stream_server_traffic_status_module.o: In function ngx_stream_server_traffic_status_init': /opt/nginx-modules/nginx-module-stream-sts/src/ngx_stream_server_traffic_status_module.c:617: undefined reference to ngx_stream_core_module'
objs/addon/src/ngx_stream_server_traffic_status_shm.o: In function ngx_stream_server_traffic_status_shm_add_filter_node': /opt/nginx-modules/nginx-module-stream-sts/src/ngx_stream_server_traffic_status_shm.c:162: undefined reference to ngx_stream_complex_value'
/opt/nginx-modules/nginx-module-stream-sts/src/ngx_stream_server_traffic_status_shm.c:166: undefined reference to ngx_stream_complex_value' objs/addon/src/ngx_stream_server_traffic_status_shm.o: In function ngx_stream_server_traffic_status_shm_add_upstream':
/opt/nginx-modules/nginx-module-stream-sts/src/ngx_stream_server_traffic_status_shm.c:298: undefined reference to ngx_stream_upstream_module' objs/addon/src/ngx_stream_server_traffic_status_filter.o: In function ngx_stream_server_traffic_status_filter_by_set_key':
/opt/nginx-modules/nginx-module-stream-sts/src/ngx_stream_server_traffic_status_filter.c:315: undefined reference to ngx_stream_compile_complex_value' /opt/nginx-modules/nginx-module-stream-sts/src/ngx_stream_server_traffic_status_filter.c:333: undefined reference to ngx_stream_compile_complex_value'
objs/addon/src/ngx_stream_server_traffic_status_limit.o: In function ngx_stream_server_traffic_status_limit_handler_traffic': /opt/nginx-modules/nginx-module-stream-sts/src/ngx_stream_server_traffic_status_limit.c:100: undefined reference to ngx_stream_complex_value'
/opt/nginx-modules/nginx-module-stream-sts/src/ngx_stream_server_traffic_status_limit.c:110: undefined reference to ngx_stream_complex_value' objs/addon/src/ngx_stream_server_traffic_status_limit.o: In function ngx_stream_server_traffic_status_limit_traffic':
/opt/nginx-modules/nginx-module-stream-sts/src/ngx_stream_server_traffic_status_limit.c:237: undefined reference to ngx_stream_compile_complex_value' objs/addon/src/ngx_stream_server_traffic_status_limit.o: In function ngx_stream_server_traffic_status_limit_traffic_by_set_key':
/opt/nginx-modules/nginx-module-stream-sts/src/ngx_stream_server_traffic_status_limit.c:345: undefined reference to ngx_stream_compile_complex_value' /opt/nginx-modules/nginx-module-stream-sts/src/ngx_stream_server_traffic_status_limit.c:358: undefined reference to ngx_stream_compile_complex_value'
objs/addon/src/ngx_stream_server_traffic_status_variables.o: In function ngx_stream_server_traffic_status_add_variables': /opt/nginx-modules/nginx-module-stream-sts/src/ngx_stream_server_traffic_status_variables.c:140: undefined reference to ngx_stream_add_variable'

Performance impact while using stream-sts

Hello,

we use vts and sts nginx modules. Unfortunately we have experienced strange performance issues and after debugging it seems that sts module causes them.

We have couple of nginx which proxies all kind of traffic (tcp, udp, http) and on those which proxies much tcp/udp traffic and have sts module enabled we see big performance drop (even in http part). I am attaching one of our metric which shows how drastically upstream response drops when module is disabled:

image

It is worth noting that we haven't observed any visible impact when we disabled vts module, also this problem appears only during peak hours.

Compile failed with nginx 1.13.10 / 1.15.0

/configure --with-http_slice_module --with-http_ssl_module --with-http_realip_module --with-http_mp4_module --with-http_geoip_module --with-http_flv_module --with-threads --with-http_stub_status_module --add-module=/root/nginx-rtmp-module-1.2.1/ --add-module=/root/nginx-module-vts --add-module=/root/nginx-module-stream-sts --add-module=/root/nginx-module-sts

Problem when i run make i get errors:
In file included from /root/nginx-module-sts/src/ngx_http_stream_server_traffic_status_module.c:9:0: /root/nginx-module-sts/src/ngx_http_stream_server_traffic_status_module.h:15:24: fatal error: ngx_stream.h: No such file or directory #include <ngx_stream.h> ^ compilation terminated. objs/Makefile:1751: recipe for target 'objs/addon/src/ngx_http_stream_server_traffic_status_module.o' failed make[1]: *** [objs/addon/src/ngx_http_stream_server_traffic_status_module.o] Error 1 make[1]: *** Waiting for unfinished jobs.... In file included from /root/nginx-module-sts/src/ngx_http_stream_server_traffic_status_shm.c:9:0: /root/nginx-module-sts/src/ngx_http_stream_server_traffic_status_module.h:15:24: fatal error: ngx_stream.h: No such file or directory #include <ngx_stream.h> ^ compilation terminated. objs/Makefile:1765: recipe for target 'objs/addon/src/ngx_http_stream_server_traffic_status_shm.o' failed make[1]: *** [objs/addon/src/ngx_http_stream_server_traffic_status_shm.o] Error 1 In file included from /root/nginx-module-sts/src/ngx_http_stream_server_traffic_status_node.c:9:0: /root/nginx-module-sts/src/ngx_http_stream_server_traffic_status_module.h:15:24: fatal error: ngx_stream.h: No such file or directory #include <ngx_stream.h>

Seem like can't find Nginx file (https://github.com/nginx/nginx-releases/blob/master/src/stream/ngx_stream.h)

debian 9, checking for OS

  • Linux 4.9.0-6-amd64 x86_64
    checking for C compiler ... found
  • using GNU C compiler
  • gcc version: 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)

We have no problem to build vts. Problem is only on sts modules.

Thank you for your great job!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.