Compare commits

...
This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.

4 Commits

Author SHA1 Message Date
Karol Wypchło 05fe41f75c
Merge branch 'master' into add-nginx-stats-endpoint 2022-02-25 13:12:24 +01:00
Karol Wypchlo 21e234b1c7
parse values as number 2022-02-23 13:43:20 +01:00
Karol Wypchlo 6358e2dac4
add response content type 2022-02-23 13:41:06 +01:00
Karol Wypchlo c5316a41eb
nginx stats endpoint 2022-02-23 13:06:21 +01:00
1 changed files with 23 additions and 0 deletions

View File

@ -71,6 +71,29 @@ location /skynet/stats {
proxy_pass http://sia:9980/skynet/stats; proxy_pass http://sia:9980/skynet/stats;
} }
location /nginx/stats {
include /etc/nginx/conf.d/include/cors;
charset utf-8;
charset_types application/json;
default_type application/json;
content_by_lua_block {
local json = require('cjson')
ngx.say(json.encode{
-- current number of active client connections including waiting connections
connections_active = tonumber(ngx.var.connections_active),
-- current number of connections where nginx is reading the request header
connections_reading = tonumber(ngx.var.connections_reading),
-- current number of connections where nginx is writing the response back to the client
connections_writing = tonumber(ngx.var.connections_writing),
-- current number of idle client connections waiting for a request
connections_waiting = tonumber(ngx.var.connections_waiting),
})
return ngx.exit(ngx.HTTP_OK)
}
}
# Define path for server load endpoint # Define path for server load endpoint
location /serverload { location /serverload {
# Define root directory in the nginx container to load file from # Define root directory in the nginx container to load file from