-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Signed-off-by: Paul Zavadski <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,13 @@ NGINX Unit updated to 1.31.0. | |
date="" time="" | ||
packager="Nginx Packaging <[email protected]>"> | ||
|
||
<change type="feature"> | ||
<para> | ||
added unit section to /status endpoint. | ||
unit section is about web-server version, control_socket and etc. | ||
</para> | ||
</change> | ||
|
||
<change type="change"> | ||
<para> | ||
if building with njs, version 0.8.0 or later is now required. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,11 @@ nxt_status_get(nxt_status_report_t *report, nxt_mp_t *mp) | |
nxt_status_app_t *app; | ||
nxt_conf_value_t *status, *obj, *apps, *app_obj; | ||
|
||
static nxt_str_t about_str = nxt_string("unit"); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
static nxt_str_t ver_str = nxt_string("version"); | ||
static nxt_str_t socket_str = nxt_string("control_socket"); | ||
static nxt_str_t cver_str = nxt_string(NXT_VERSION); | ||
This comment has been minimized.
Sorry, something went wrong.
hongzhidao
|
||
static nxt_str_t csocket_str = nxt_string(NXT_CONTROL_SOCK); | ||
static nxt_str_t conns_str = nxt_string("connections"); | ||
static nxt_str_t acc_str = nxt_string("accepted"); | ||
static nxt_str_t active_str = nxt_string("active"); | ||
|
@@ -29,17 +34,27 @@ nxt_status_get(nxt_status_report_t *report, nxt_mp_t *mp) | |
static nxt_str_t run_str = nxt_string("running"); | ||
static nxt_str_t start_str = nxt_string("starting"); | ||
|
||
status = nxt_conf_create_object(mp, 3); | ||
status = nxt_conf_create_object(mp, 4); | ||
if (nxt_slow_path(status == NULL)) { | ||
return NULL; | ||
} | ||
|
||
obj = nxt_conf_create_object(mp, 2); | ||
if (nxt_slow_path(obj == NULL)) { | ||
return NULL; | ||
} | ||
|
||
nxt_conf_set_member(status, &about_str, obj, 0); | ||
|
||
nxt_conf_set_member_string(obj, &ver_str, &cver_str, 0); | ||
nxt_conf_set_member_string(obj, &socket_str, &csocket_str, 1); | ||
|
||
obj = nxt_conf_create_object(mp, 4); | ||
if (nxt_slow_path(obj == NULL)) { | ||
return NULL; | ||
} | ||
|
||
nxt_conf_set_member(status, &conns_str, obj, 0); | ||
nxt_conf_set_member(status, &conns_str, obj, 1); | ||
|
||
nxt_conf_set_member_integer(obj, &acc_str, report->accepted_conns, 0); | ||
nxt_conf_set_member_integer(obj, &active_str, report->accepted_conns | ||
|
@@ -53,7 +68,7 @@ nxt_status_get(nxt_status_report_t *report, nxt_mp_t *mp) | |
return NULL; | ||
} | ||
|
||
nxt_conf_set_member(status, &reqs_str, obj, 1); | ||
nxt_conf_set_member(status, &reqs_str, obj, 2); | ||
|
||
nxt_conf_set_member_integer(obj, &total_str, report->requests, 0); | ||
|
||
|
@@ -62,7 +77,7 @@ nxt_status_get(nxt_status_report_t *report, nxt_mp_t *mp) | |
return NULL; | ||
} | ||
|
||
nxt_conf_set_member(status, &apps_str, apps, 2); | ||
nxt_conf_set_member(status, &apps_str, apps, 3); | ||
|
||
for (i = 0; i < report->apps_count; i++) { | ||
app = &report->apps[i]; | ||
|
I'd suggest
unit_str
instead ofabout_str
.