Add counter for socket unit refuse events (#9217)

core: add counter for socket unit rejection events
This commit is contained in:
xginn8
2018-06-11 12:56:26 +02:00
committed by Lennart Poettering
parent c602fd0f19
commit a98f7575ae
4 changed files with 30 additions and 13 deletions
+9 -2
View File
@@ -3890,6 +3890,7 @@ typedef struct UnitStatusInfo {
/* Socket */
unsigned n_accepted;
unsigned n_connections;
unsigned n_refused;
bool accept;
/* Pairs of type, path */
@@ -4155,8 +4156,13 @@ static void print_status_info(
STRV_FOREACH_PAIR(t, t2, i->listen)
printf(" %*s %s (%s)\n", 9, t == i->listen ? "Listen:" : "", *t2, *t);
if (i->accept)
printf(" Accepted: %u; Connected: %u\n", i->n_accepted, i->n_connections);
if (i->accept) {
printf(" Accepted: %u; Connected: %u;", i->n_accepted, i->n_connections);
if (i->n_refused)
printf(" Refused: %u", i->n_refused);
printf("\n");
}
LIST_FOREACH(exec, p, i->exec) {
_cleanup_free_ char *argv = NULL;
@@ -4956,6 +4962,7 @@ static int show_one(
{ "NextElapseUSecMonotonic", "t", NULL, offsetof(UnitStatusInfo, next_elapse_monotonic) },
{ "NAccepted", "u", NULL, offsetof(UnitStatusInfo, n_accepted) },
{ "NConnections", "u", NULL, offsetof(UnitStatusInfo, n_connections) },
{ "NRefused", "u", NULL, offsetof(UnitStatusInfo, n_refused) },
{ "Accept", "b", NULL, offsetof(UnitStatusInfo, accept) },
{ "Listen", "a(ss)", map_listen, offsetof(UnitStatusInfo, listen) },
{ "SysFSPath", "s", NULL, offsetof(UnitStatusInfo, sysfs_path) },