Monitor nginx with status information
http {
lua_shared_dict store 10m; # rely on `store.lua`
init_by_lua "monitor = require 'monitor'";
log_by_lua "monitor.group()";
location /status {
content_by_lua "monitor.status()";
}
}
Default shows dashboard (TODO), refresh by itself
/status?format=json
shows status with json
/status?format=plain
shows status with plain string
You can get the one data by path param
/status?format=plain&path=zones.zonename.request_per_second
monitor.lua
will cache last 5 seconds data by default, you can change it by monitor.cacheSeconds = 6
to cache 6 seconds data
Never worry about if sum number is too big, because lua max number is math.pow(2, 1023) * 1.9999...
, even your qps is billion, you can run billion years without restart