diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 08:15:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 08:15:20 +0000 |
commit | 87d772a7d708fec12f48cd8adc0dedff6e1025da (patch) | |
tree | 1fee344c64cc3f43074a01981e21126c8482a522 /src/collectors/network-viewer.plugin | |
parent | Adding upstream version 1.46.3. (diff) | |
download | netdata-87d772a7d708fec12f48cd8adc0dedff6e1025da.tar.xz netdata-87d772a7d708fec12f48cd8adc0dedff6e1025da.zip |
Adding upstream version 1.47.0.upstream/1.47.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/collectors/network-viewer.plugin')
-rw-r--r-- | src/collectors/network-viewer.plugin/network-viewer.c | 367 |
1 files changed, 298 insertions, 69 deletions
diff --git a/src/collectors/network-viewer.plugin/network-viewer.c b/src/collectors/network-viewer.plugin/network-viewer.c index 764151f5c..06dde7382 100644 --- a/src/collectors/network-viewer.plugin/network-viewer.c +++ b/src/collectors/network-viewer.plugin/network-viewer.c @@ -2,18 +2,30 @@ #include "collectors/all.h" #include "libnetdata/libnetdata.h" + #include "libnetdata/required_dummies.h" +static SPAWN_SERVER *spawn_srv = NULL; + #define ENABLE_DETAILED_VIEW #define LOCAL_SOCKETS_EXTENDED_MEMBERS struct { \ size_t count; \ - const char *local_address_space; \ - const char *remote_address_space; \ + struct { \ + pid_t pid; \ + uid_t uid; \ + SOCKET_DIRECTION direction; \ + int state; \ + uint64_t net_ns_inode; \ + struct socket_endpoint server; \ + const char *local_address_space; \ + const char *remote_address_space; \ + } aggregated_key; \ } network_viewer; #include "libnetdata/maps/local-sockets.h" #include "libnetdata/maps/system-users.h" +#include "libnetdata/maps/system-services.h" #define NETWORK_CONNECTIONS_VIEWER_FUNCTION "network-connections" #define NETWORK_CONNECTIONS_VIEWER_HELP "Network connections explorer" @@ -25,6 +37,7 @@ netdata_mutex_t stdout_mutex = NETDATA_MUTEX_INITIALIZER; static bool plugin_should_exit = false; static USERNAMES_CACHE *uc; +static SERVICENAMES_CACHE *sc; ENUM_STR_MAP_DEFINE(SOCKET_DIRECTION) = { { .id = SOCKET_DIRECTION_LISTEN, .name = "listen" }, @@ -57,19 +70,49 @@ ENUM_STR_MAP_DEFINE(TCP_STATE) = { }; ENUM_STR_DEFINE_FUNCTIONS(TCP_STATE, 0, "unknown"); -static void local_socket_to_json_array(BUFFER *wb, LOCAL_SOCKET *n, uint64_t proc_self_net_ns_inode, bool aggregated) { +struct sockets_stats { + BUFFER *wb; + + struct { + uint32_t tcpi_rtt; + uint32_t tcpi_rcv_rtt; + uint32_t tcpi_total_retrans; + } max; +}; + +static void local_socket_to_json_array(struct sockets_stats *st, LOCAL_SOCKET *n, uint64_t proc_self_net_ns_inode, bool aggregated) { + if(n->direction == SOCKET_DIRECTION_NONE) + return; + + BUFFER *wb = st->wb; + char local_address[INET6_ADDRSTRLEN]; char remote_address[INET6_ADDRSTRLEN]; char *protocol; if(n->local.family == AF_INET) { ipv4_address_to_txt(n->local.ip.ipv4, local_address); - ipv4_address_to_txt(n->remote.ip.ipv4, remote_address); + + if(local_sockets_is_zero_address(&n->remote)) + remote_address[0] = '\0'; + else + ipv4_address_to_txt(n->remote.ip.ipv4, remote_address); + protocol = n->local.protocol == IPPROTO_TCP ? "tcp4" : "udp4"; } + else if(is_local_socket_ipv46(n)) { + strncpyz(local_address, "*", sizeof(local_address) - 1); + remote_address[0] = '\0'; + protocol = n->local.protocol == IPPROTO_TCP ? "tcp46" : "udp46"; + } else if(n->local.family == AF_INET6) { ipv6_address_to_txt(&n->local.ip.ipv6, local_address); - ipv6_address_to_txt(&n->remote.ip.ipv6, remote_address); + + if(local_sockets_is_zero_address(&n->remote)) + remote_address[0] = '\0'; + else + ipv6_address_to_txt(&n->remote.ip.ipv6, remote_address); + protocol = n->local.protocol == IPPROTO_TCP ? "tcp6" : "udp6"; } else @@ -113,47 +156,60 @@ static void local_socket_to_json_array(BUFFER *wb, LOCAL_SOCKET *n, uint64_t pro string_freez(u); } - if(!aggregated) { - buffer_json_add_array_item_string(wb, local_address); - buffer_json_add_array_item_uint64(wb, n->local.port); - } - buffer_json_add_array_item_string(wb, n->network_viewer.local_address_space); - - if(!aggregated) { - buffer_json_add_array_item_string(wb, remote_address); - buffer_json_add_array_item_uint64(wb, n->remote.port); - } - buffer_json_add_array_item_string(wb, n->network_viewer.remote_address_space); - - uint16_t server_port = 0; - const char *server_address = NULL; - const char *client_address_space = NULL; - const char *server_address_space = NULL; + struct socket_endpoint *server_endpoint; + const char *server_address; + const char *client_address_space; + const char *server_address_space; switch (n->direction) { case SOCKET_DIRECTION_LISTEN: case SOCKET_DIRECTION_INBOUND: case SOCKET_DIRECTION_LOCAL_INBOUND: - server_port = n->local.port; server_address = local_address; - server_address_space = n->network_viewer.local_address_space; - client_address_space = n->network_viewer.remote_address_space; + server_address_space = n->network_viewer.aggregated_key.local_address_space; + client_address_space = n->network_viewer.aggregated_key.remote_address_space; + server_endpoint = &n->local; break; case SOCKET_DIRECTION_OUTBOUND: case SOCKET_DIRECTION_LOCAL_OUTBOUND: - server_port = n->remote.port; server_address = remote_address; - server_address_space = n->network_viewer.remote_address_space; - client_address_space = n->network_viewer.local_address_space; + server_address_space = n->network_viewer.aggregated_key.remote_address_space; + client_address_space = n->network_viewer.aggregated_key.local_address_space; + server_endpoint = &n->remote; break; case SOCKET_DIRECTION_NONE: + server_address = NULL; + client_address_space = NULL; + server_address_space = NULL; + server_endpoint = NULL; break; } - if(aggregated) + + if(server_endpoint) { + STRING *serv = system_servicenames_cache_lookup(sc, server_endpoint->port, server_endpoint->protocol); + buffer_json_add_array_item_string(wb, string2str(serv)); + } + else + buffer_json_add_array_item_string(wb, "[unknown]"); + + if(!aggregated) { + buffer_json_add_array_item_string(wb, local_address); + buffer_json_add_array_item_uint64(wb, n->local.port); + } + buffer_json_add_array_item_string(wb, n->network_viewer.aggregated_key.local_address_space); + + if(!aggregated) { + buffer_json_add_array_item_string(wb, remote_address); + buffer_json_add_array_item_uint64(wb, n->remote.port); + } + buffer_json_add_array_item_string(wb, n->network_viewer.aggregated_key.remote_address_space); + + if(aggregated) { buffer_json_add_array_item_string(wb, server_address); + } - buffer_json_add_array_item_uint64(wb, server_port); + buffer_json_add_array_item_uint64(wb, n->network_viewer.aggregated_key.server.port); if(aggregated) { buffer_json_add_array_item_string(wb, client_address_space); @@ -162,58 +218,176 @@ static void local_socket_to_json_array(BUFFER *wb, LOCAL_SOCKET *n, uint64_t pro // buffer_json_add_array_item_uint64(wb, n->inode); // buffer_json_add_array_item_uint64(wb, n->net_ns_inode); + + // RTT + buffer_json_add_array_item_double(wb, (double)n->info.tcp.tcpi_rtt / (double)USEC_PER_MS); + if(st->max.tcpi_rtt < n->info.tcp.tcpi_rtt) + st->max.tcpi_rtt = n->info.tcp.tcpi_rtt; + + // Receiver RTT + buffer_json_add_array_item_double(wb, (double)n->info.tcp.tcpi_rcv_rtt / (double)USEC_PER_MS); + if(st->max.tcpi_rcv_rtt < n->info.tcp.tcpi_rcv_rtt) + st->max.tcpi_rcv_rtt = n->info.tcp.tcpi_rcv_rtt; + + // Retransmissions + buffer_json_add_array_item_uint64(wb, n->info.tcp.tcpi_total_retrans); + if(st->max.tcpi_total_retrans < n->info.tcp.tcpi_total_retrans) + st->max.tcpi_total_retrans = n->info.tcp.tcpi_total_retrans; + + // count buffer_json_add_array_item_uint64(wb, n->network_viewer.count); } buffer_json_array_close(wb); } -static void local_sockets_cb_to_json(LS_STATE *ls, LOCAL_SOCKET *n, void *data) { +static void populate_aggregated_key(LOCAL_SOCKET *n) { n->network_viewer.count = 1; - n->network_viewer.local_address_space = local_sockets_address_space(&n->local); - n->network_viewer.remote_address_space = local_sockets_address_space(&n->remote); - local_socket_to_json_array(data, n, ls->proc_self_net_ns_inode, false); -} -static void local_sockets_cb_to_aggregation(LS_STATE *ls __maybe_unused, LOCAL_SOCKET *n, void *data) { - SIMPLE_HASHTABLE_AGGREGATED_SOCKETS *ht = data; - n->network_viewer.count = 1; - n->network_viewer.local_address_space = local_sockets_address_space(&n->local); - n->network_viewer.remote_address_space = local_sockets_address_space(&n->remote); + n->network_viewer.aggregated_key.pid = n->pid; + n->network_viewer.aggregated_key.uid = n->uid; + n->network_viewer.aggregated_key.direction = n->direction; + n->network_viewer.aggregated_key.net_ns_inode = n->net_ns_inode; + n->network_viewer.aggregated_key.state = n->state; switch(n->direction) { case SOCKET_DIRECTION_INBOUND: case SOCKET_DIRECTION_LOCAL_INBOUND: case SOCKET_DIRECTION_LISTEN: - memset(&n->remote.ip, 0, sizeof(n->remote.ip)); - n->remote.port = 0; + n->network_viewer.aggregated_key.server = n->local; break; case SOCKET_DIRECTION_OUTBOUND: case SOCKET_DIRECTION_LOCAL_OUTBOUND: - memset(&n->local.ip, 0, sizeof(n->local.ip)); - n->local.port = 0; + n->network_viewer.aggregated_key.server = n->remote; break; case SOCKET_DIRECTION_NONE: - return; + break; } - n->inode = 0; - n->local_ip_hash = 0; - n->remote_ip_hash = 0; - n->local_port_hash = 0; - n->timer = 0; - n->retransmits = 0; - n->expires = 0; - n->rqueue = 0; - n->wqueue = 0; - memset(&n->local_port_key, 0, sizeof(n->local_port_key)); - - XXH64_hash_t hash = XXH3_64bits(n, sizeof(*n)); + n->network_viewer.aggregated_key.local_address_space = local_sockets_address_space(&n->local); + n->network_viewer.aggregated_key.remote_address_space = local_sockets_address_space(&n->remote); +} + +static void local_sockets_cb_to_json(LS_STATE *ls, LOCAL_SOCKET *n, void *data) { + struct sockets_stats *st = data; + populate_aggregated_key(n); + local_socket_to_json_array(st, n, ls->proc_self_net_ns_inode, false); +} + +#define KEEP_THE_BIGGER(a, b) (a) = ((a) < (b)) ? (b) : (a) +#define KEEP_THE_SMALLER(a, b) (a) = ((a) > (b)) ? (b) : (a) +#define SUM_THEM_ALL(a, b) (a) += (b) +#define OR_THEM_ALL(a, b) (a) |= (b) + +static void local_sockets_cb_to_aggregation(LS_STATE *ls __maybe_unused, LOCAL_SOCKET *n, void *data) { + SIMPLE_HASHTABLE_AGGREGATED_SOCKETS *ht = data; + + populate_aggregated_key(n); + XXH64_hash_t hash = XXH3_64bits(&n->network_viewer.aggregated_key, sizeof(n->network_viewer.aggregated_key)); SIMPLE_HASHTABLE_SLOT_AGGREGATED_SOCKETS *sl = simple_hashtable_get_slot_AGGREGATED_SOCKETS(ht, hash, n, true); LOCAL_SOCKET *t = SIMPLE_HASHTABLE_SLOT_DATA(sl); if(t) { t->network_viewer.count++; + + KEEP_THE_BIGGER(t->timer, n->timer); + KEEP_THE_BIGGER(t->retransmits, n->retransmits); + KEEP_THE_SMALLER(t->expires, n->expires); + KEEP_THE_BIGGER(t->rqueue, n->rqueue); + KEEP_THE_BIGGER(t->wqueue, n->wqueue); + + // The current number of consecutive retransmissions that have occurred for the most recently transmitted segment. + SUM_THEM_ALL(t->info.tcp.tcpi_retransmits, n->info.tcp.tcpi_retransmits); + + // The total number of retransmissions that have occurred for the entire connection since it was established. + SUM_THEM_ALL(t->info.tcp.tcpi_total_retrans, n->info.tcp.tcpi_total_retrans); + + // The total number of segments that have been retransmitted since the connection was established. + SUM_THEM_ALL(t->info.tcp.tcpi_retrans, n->info.tcp.tcpi_retrans); + + // The number of keepalive probes sent + SUM_THEM_ALL(t->info.tcp.tcpi_probes, n->info.tcp.tcpi_probes); + + // The number of times the retransmission timeout has been backed off. + SUM_THEM_ALL(t->info.tcp.tcpi_backoff, n->info.tcp.tcpi_backoff); + + // A bitmask representing the TCP options currently enabled for the connection, such as SACK and Timestamps. + OR_THEM_ALL(t->info.tcp.tcpi_options, n->info.tcp.tcpi_options); + + // The send window scale value used for this connection + KEEP_THE_SMALLER(t->info.tcp.tcpi_snd_wscale, n->info.tcp.tcpi_snd_wscale); + + // The receive window scale value used for this connection + KEEP_THE_SMALLER(t->info.tcp.tcpi_rcv_wscale, n->info.tcp.tcpi_rcv_wscale); + + // Retransmission timeout in milliseconds + KEEP_THE_SMALLER(t->info.tcp.tcpi_rto, n->info.tcp.tcpi_rto); + + // The delayed acknowledgement timeout in milliseconds. + KEEP_THE_SMALLER(t->info.tcp.tcpi_ato, n->info.tcp.tcpi_ato); + + // The maximum segment size for sending. + KEEP_THE_SMALLER(t->info.tcp.tcpi_snd_mss, n->info.tcp.tcpi_snd_mss); + + // The maximum segment size for receiving. + KEEP_THE_SMALLER(t->info.tcp.tcpi_rcv_mss, n->info.tcp.tcpi_rcv_mss); + + // The number of unacknowledged segments + SUM_THEM_ALL(t->info.tcp.tcpi_unacked, n->info.tcp.tcpi_unacked); + + // The number of segments that have been selectively acknowledged + SUM_THEM_ALL(t->info.tcp.tcpi_sacked, n->info.tcp.tcpi_sacked); + + // The number of segments that have been selectively acknowledged + SUM_THEM_ALL(t->info.tcp.tcpi_sacked, n->info.tcp.tcpi_sacked); + + // The number of lost segments. + SUM_THEM_ALL(t->info.tcp.tcpi_lost, n->info.tcp.tcpi_lost); + + // The number of forward acknowledgment segments. + SUM_THEM_ALL(t->info.tcp.tcpi_fackets, n->info.tcp.tcpi_fackets); + + // The time in milliseconds since the last data was sent. + KEEP_THE_SMALLER(t->info.tcp.tcpi_last_data_sent, n->info.tcp.tcpi_last_data_sent); + + // The time in milliseconds since the last acknowledgment was sent (not tracked in Linux, hence often zero). + KEEP_THE_SMALLER(t->info.tcp.tcpi_last_ack_sent, n->info.tcp.tcpi_last_ack_sent); + + // The time in milliseconds since the last data was received. + KEEP_THE_SMALLER(t->info.tcp.tcpi_last_data_recv, n->info.tcp.tcpi_last_data_recv); + + // The time in milliseconds since the last acknowledgment was received. + KEEP_THE_SMALLER(t->info.tcp.tcpi_last_ack_recv, n->info.tcp.tcpi_last_ack_recv); + + // The path MTU for this connection + KEEP_THE_SMALLER(t->info.tcp.tcpi_pmtu, n->info.tcp.tcpi_pmtu); + + // The slow start threshold for receiving + KEEP_THE_SMALLER(t->info.tcp.tcpi_rcv_ssthresh, n->info.tcp.tcpi_rcv_ssthresh); + + // The slow start threshold for sending + KEEP_THE_SMALLER(t->info.tcp.tcpi_snd_ssthresh, n->info.tcp.tcpi_snd_ssthresh); + + // The round trip time in milliseconds + KEEP_THE_BIGGER(t->info.tcp.tcpi_rtt, n->info.tcp.tcpi_rtt); + + // The round trip time variance in milliseconds. + KEEP_THE_BIGGER(t->info.tcp.tcpi_rttvar, n->info.tcp.tcpi_rttvar); + + // The size of the sending congestion window. + KEEP_THE_SMALLER(t->info.tcp.tcpi_snd_cwnd, n->info.tcp.tcpi_snd_cwnd); + + // The maximum segment size that could be advertised. + KEEP_THE_BIGGER(t->info.tcp.tcpi_advmss, n->info.tcp.tcpi_advmss); + + // The reordering metric + KEEP_THE_SMALLER(t->info.tcp.tcpi_reordering, n->info.tcp.tcpi_reordering); + + // The receive round trip time in milliseconds. + KEEP_THE_BIGGER(t->info.tcp.tcpi_rcv_rtt, n->info.tcp.tcpi_rcv_rtt); + + // The available space in the receive buffer. + KEEP_THE_SMALLER(t->info.tcp.tcpi_rcv_space, n->info.tcp.tcpi_rcv_space); } else { t = mallocz(sizeof(*t)); @@ -240,6 +414,10 @@ void network_viewer_function(const char *transaction, char *function __maybe_unu wb->content_type = CT_APPLICATION_JSON; buffer_json_initialize(wb, "\"", "\"", 0, true, BUFFER_JSON_OPTIONS_MINIFY); + struct sockets_stats st = { + .wb = wb, + }; + buffer_json_member_add_uint64(wb, "status", HTTP_RESP_OK); buffer_json_member_add_string(wb, "type", "table"); buffer_json_member_add_time_t(wb, "update_every", 5); @@ -328,9 +506,12 @@ void network_viewer_function(const char *transaction, char *function __maybe_unu .cmdline = true, .comm = true, .namespaces = true, + .tcp_info = true, .max_errors = 10, + .max_concurrent_namespaces = 5, }, + .spawn_server = spawn_srv, .stats = { 0 }, .sockets_hashtable = { 0 }, .local_ips_hashtable = { 0 }, @@ -345,7 +526,7 @@ void network_viewer_function(const char *transaction, char *function __maybe_unu } else { ls.config.cb = local_sockets_cb_to_json; - ls.config.data = wb; + ls.config.data = &st; } local_sockets_process(&ls); @@ -366,7 +547,7 @@ void network_viewer_function(const char *transaction, char *function __maybe_unu qsort(array, added, sizeof(LOCAL_SOCKET *), local_sockets_compar); for(size_t i = 0; i < added ;i++) { - local_socket_to_json_array(wb, array[i], proc_self_net_ns_inode, true); + local_socket_to_json_array(&st, array[i], proc_self_net_ns_inode, true); string_freez(array[i]->cmdline); freez(array[i]); } @@ -451,6 +632,14 @@ void network_viewer_function(const char *transaction, char *function __maybe_unu RRDF_FIELD_OPTS_VISIBLE, NULL); + // Portname + buffer_rrdf_table_add_field(wb, field_id++, "Portname", "Server Port Name", + RRDF_FIELD_TYPE_STRING, RRDF_FIELD_VISUAL_VALUE, RRDF_FIELD_TRANSFORM_NONE, + 0, NULL, NAN, RRDF_FIELD_SORT_ASCENDING, NULL, + RRDF_FIELD_SUMMARY_COUNT, RRDF_FIELD_FILTER_MULTISELECT, + RRDF_FIELD_OPTS_VISIBLE, + NULL); + if(!aggregated) { // Local Address buffer_rrdf_table_add_field(wb, field_id++, "LocalIP", "Local IP Address", @@ -555,14 +744,40 @@ void network_viewer_function(const char *transaction, char *function __maybe_unu // RRDF_FIELD_OPTS_NONE, // NULL); + + // RTT + buffer_rrdf_table_add_field(wb, field_id++, "RTT", aggregated ? "Max Smoothed Round Trip Time" : "Smoothed Round Trip Time", + RRDF_FIELD_TYPE_DURATION, RRDF_FIELD_VISUAL_VALUE, RRDF_FIELD_TRANSFORM_NUMBER, + 2, "ms", st.max.tcpi_rtt / USEC_PER_MS, RRDF_FIELD_SORT_DESCENDING, NULL, + RRDF_FIELD_SUMMARY_MAX, RRDF_FIELD_FILTER_RANGE, + RRDF_FIELD_OPTS_VISIBLE, + NULL); + + // Asymmetry RTT + buffer_rrdf_table_add_field(wb, field_id++, "RecvRTT", aggregated ? "Max Receiver ACKs RTT" : "Receiver ACKs RTT", + RRDF_FIELD_TYPE_DURATION, RRDF_FIELD_VISUAL_VALUE, RRDF_FIELD_TRANSFORM_NUMBER, + 2, "ms", st.max.tcpi_rcv_rtt / USEC_PER_MS, RRDF_FIELD_SORT_DESCENDING, NULL, + RRDF_FIELD_SUMMARY_MAX, RRDF_FIELD_FILTER_RANGE, + RRDF_FIELD_OPTS_VISIBLE, + NULL); + + // Rentrasmissions + buffer_rrdf_table_add_field(wb, field_id++, "Retrans", "Total Retransmissions", + RRDF_FIELD_TYPE_INTEGER, RRDF_FIELD_VISUAL_VALUE, RRDF_FIELD_TRANSFORM_NONE, + 0, "packets", st.max.tcpi_total_retrans, RRDF_FIELD_SORT_DESCENDING, NULL, + RRDF_FIELD_SUMMARY_SUM, RRDF_FIELD_FILTER_RANGE, + RRDF_FIELD_OPTS_VISIBLE, + NULL); + // Count buffer_rrdf_table_add_field(wb, field_id++, "Count", "Number of sockets like this", RRDF_FIELD_TYPE_INTEGER, RRDF_FIELD_VISUAL_VALUE, RRDF_FIELD_TRANSFORM_NONE, - 0, NULL, NAN, RRDF_FIELD_SORT_DESCENDING, NULL, - RRDF_FIELD_SUMMARY_COUNT, RRDF_FIELD_FILTER_NONE, + 0, "sockets", NAN, RRDF_FIELD_SORT_DESCENDING, NULL, + RRDF_FIELD_SUMMARY_SUM, RRDF_FIELD_FILTER_NONE, aggregated ? (RRDF_FIELD_OPTS_VISIBLE | RRDF_FIELD_OPTS_STICKY) : RRDF_FIELD_OPTS_NONE, NULL); } + buffer_json_object_close(wb); // columns buffer_json_member_add_string(wb, "default_sort_column", aggregated ? "Count" : "Direction"); @@ -745,20 +960,31 @@ int main(int argc __maybe_unused, char **argv __maybe_unused) { netdata_configured_host_prefix = getenv("NETDATA_HOST_PREFIX"); if(verify_netdata_host_prefix(true) == -1) exit(1); + spawn_srv = spawn_server_create(SPAWN_SERVER_OPTION_CALLBACK, "setns", local_sockets_spawn_server_callback, argc, (const char **)argv); + if(spawn_srv == NULL) { + fprintf(stderr, "Cannot create spawn server.\n"); + exit(1); + } + uc = system_usernames_cache_init(); + sc = system_servicenames_cache_init(); // ---------------------------------------------------------------------------------------------------------------- if(argc == 2 && strcmp(argv[1], "debug") == 0) { - bool cancelled = false; - usec_t stop_monotonic_ut = now_monotonic_usec() + 600 * USEC_PER_SEC; - char buf[] = "network-connections sockets:aggregated"; - network_viewer_function("123", buf, &stop_monotonic_ut, &cancelled, - NULL, HTTP_ACCESS_ALL, NULL, NULL); - - char buf2[] = "network-connections sockets:detailed"; - network_viewer_function("123", buf2, &stop_monotonic_ut, &cancelled, - NULL, HTTP_ACCESS_ALL, NULL, NULL); +// for(int i = 0; i < 100; i++) { + bool cancelled = false; + usec_t stop_monotonic_ut = now_monotonic_usec() + 600 * USEC_PER_SEC; + char buf[] = "network-connections sockets:aggregated"; + network_viewer_function("123", buf, &stop_monotonic_ut, &cancelled, + NULL, HTTP_ACCESS_ALL, NULL, NULL); + + char buf2[] = "network-connections sockets:detailed"; + network_viewer_function("123", buf2, &stop_monotonic_ut, &cancelled, + NULL, HTTP_ACCESS_ALL, NULL, NULL); +// } + + spawn_server_destroy(spawn_srv); exit(1); } @@ -799,5 +1025,8 @@ int main(int argc __maybe_unused, char **argv __maybe_unused) { } } + spawn_server_destroy(spawn_srv); + spawn_srv = NULL; + return 0; } |