Comments (12)
strange, restarted nginx and the negative value is gone, normal time now.
from nginx-module-vts.
To get the uptime is using the simple method which is current_time(json:nowMsec) - process_start_time(json:loadMsec) in built-in html.
If it is happening again, you need to check it(json:loadMsec and json:nowMsec in format/json).
Let me check it on the 'streams' later because of so busy now.
from nginx-module-vts.
thank you @vozlt this module is awesome and just what I was looking for. I've integrated it into my Centmin Mod LEMP stack installer's latest beta https://community.centminmod.com/threads/centmin-mod-nginx-live-vhost-traffic-statistics-preview-discussion.3022/ - works wonderfully with Nginx 1.9.1 :)
from nginx-module-vts.
It tool awhile to get back to this issue but this is a common json output when it goes wrong:
"loadMsec":4108553345,"nowMsec":20948346,
As you see loadMsec should remain static but at some point it is going negative and also starts to drift, might be a few days before I get back to the code to see why, might be a nginx internal value going bust.
from nginx-module-vts.
It is vtscf->start_msec going mad, no idea why. For the time being I'm pushing this static value onto the stack after 60sec and just use this value throughout runtime.
from nginx-module-vts.
I will check it soon.
Probably, It seem to be overflow of 32bit variables.
Is it a 32bit system?
The time variables(start_msec, now) in module is millisecond as follows:
(seconds since 1970-01-01 00:00:00 UTC) * 1000
So, In case of normal in json as follows:
{
.
.
"loadMsec":1443142379895,
"nowMsec":1443142397017`
.
.
.
The calculation of uptime second using json in html as follows:
uptime = (nowMsec - loadMsec) / 1000
from nginx-module-vts.
it is a 32bit system but in this variable case I don't think its an overflow because it happens anywhere after 3 days to 2 weeks (sometimes it never happens) and after it, it starts to drift (counting down negative). Either nginx is messing up this variable or the pointer gets invalid. ea. loadMsec(vtscf->start_msec) should be set once and stay static so it can't be an overflow issue.
from nginx-module-vts.
As you commented above: "loadMsec":4108553345,"nowMsec":20948346,
I think that the loadMsec in json was wrong because of smaller than 1420038000000(2015/01/01 12:00 to milliseconds)
Please check variable maxIntegerSize
in json.
from nginx-module-vts.
It's not a maxsize issue, let me show you an example:
nginx starts:
"loadMsec":20948346,"nowMsec":20949346,
nginx is running for a while:
"loadMsec":20948346,"nowMsec":23212222,
nginx is still running for a while:
"loadMsec":20948346,"nowMsec":25333333,
So far as it should work, loadMsec is STATIC and NEVER changes.
At some point in time (3 days <-> 2 weeks) loadMsec (which is vtscf->start_msec) returns a negative value and you get:
"loadMsec":4108553345,"nowMsec":253444444,
The question is WHY is loadMsec (which is vtscf->start_msec) becoming negative while this is a static value which should not change?
I think it is a nginx value going bust, see also:
http://hg.nginx.org/nginx/rev/8c6e71722aff
Which is not related to this value but it might be a nginx value which isn't defined large enough, but that still does not explain why a static value changes (or its pointer gets lost).
from nginx-module-vts.
Just to be sure, Is nginx's worker process restart(not to master process)?
I was wondering whether each worker process's uptime is same or not at that point.
from nginx-module-vts.
It should be a master value as uptime can't be tied to a worker which can be restarted, crashed, reloaded, etc... Most of the time (99%) vtscf->start_msec is fine and stays static.
nb. a master can reload as well (binary replace function) but the master passes some values to the new master when this happens.
from nginx-module-vts.
OK, I understand but it still may be problem of nginx-module-vts.
If you are able to modify and test, then try as below:
--- ngx_http_vhost_traffic_status_module.c.org 2015-10-15 10:32:18.023029431 +0900
+++ ngx_http_vhost_traffic_status_module.c 2015-10-15 10:43:02.524150308 +0900
@@ -1849,7 +1849,7 @@ ngx_http_vhost_traffic_status_create_loc
return NULL;
}
- conf->start_msec = (ngx_msec_t) (tp->sec * 1000 + tp->msec);
+ conf->start_msec = (ngx_msec_t) (tp->sec);
conf->enable = NGX_CONF_UNSET;
conf->shm_zone = NGX_CONF_UNSET_PTR;
conf->format = NGX_CONF_UNSET;
And check whether json's loadMsec is changed or not.
If it was changed, then please let me know its values.(for checking actual time)
FYI. I merged commit aca8fab by issue #23 just now.
from nginx-module-vts.
Related Issues (20)
- No such file or directoryodule-vts/config: line 2: auto/have HOT 2
- Label metrics with jsonrpc method HOT 16
- the status of server is not current when max_fails = 0 HOT 4
- /status/format/json not served after clean installation HOT 1
- VTS doesn't support query string encoding HOT 1
- I encountered the following Syntax error while compiling the vts source code in windows environment HOT 2
- [emerg] 1#1: module "/etc/nginx/modules/ngx_http_vhost_traffic_status_module.so" version 1022001 instead of 1025002 in /etc/nginx/nginx.conf:5 HOT 1
- periodic cleanup of shared memory? HOT 2
- Evaluate using Profile-Guided Optimization (PGO) and Post-Link Optimization (PLO) on VTS HOT 3
- Question - time window of statistics HOT 1
- Module bug HOT 4
- Will the request fail? 'ngx_slab_alloc() failed: no memory in vhost_traffic_status_zone' HOT 1
- 2024 Can this tool support TCP monitor? HOT 1
- shm_add_upstream error HOT 1
- how to disable upstream statistics collection? HOT 4
- bug: absolute URL prevent the use of a reverse proxy with a different path in front of the stats HOT 4
- the status HTML does not display HOT 1
- nginx-module-vts version 0.1.8 in OpenResty 1.21.4.3 not display upstream data HOT 9
- Dynamic compilation does not work, but static compilation works.
- 和nginx_upstream_check_module冲突
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nginx-module-vts.