vozlt / nginx-module-stream-sts Goto Github PK
View Code? Open in Web Editor NEWNginx stream server traffic status core module
License: BSD 2-Clause "Simplified" License
Nginx stream server traffic status core module
License: BSD 2-Clause "Simplified" License
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
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
OS: CentOS 6.9
Nginx info:
--add-dynamic-module=nginx-module-sts-0.1.0 --add-dynamic-module=nginx-module-stream-sts-0.1.0
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"
/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
can't use server_traffic_status_dump
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
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.
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'
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:
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.
Hello:
there is the module (nginx-stream-upsync-module
) dynamic upsync the upstream server, how can nginx-module-streem-sts trace the newest upstream server ?
/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
We have no problem to build vts. Problem is only on sts modules.
Thank you for your great job!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.