summaryrefslogtreecommitdiffstats
path: root/collectors/ebpf.plugin/ebpf_socket.h
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/ebpf.plugin/ebpf_socket.h')
-rw-r--r--collectors/ebpf.plugin/ebpf_socket.h62
1 files changed, 54 insertions, 8 deletions
diff --git a/collectors/ebpf.plugin/ebpf_socket.h b/collectors/ebpf.plugin/ebpf_socket.h
index cf439aeaeb..4c7dce8d38 100644
--- a/collectors/ebpf.plugin/ebpf_socket.h
+++ b/collectors/ebpf.plugin/ebpf_socket.h
@@ -15,7 +15,7 @@
#define NETDATA_SOCKET_GLOBAL_HASH_TABLE 4
#define NETDATA_SOCKET_LISTEN_TABLE 5
-#define NETDATA_SOCKET_READ_SLEEP_MS 400000
+#define NETDATA_SOCKET_READ_SLEEP_MS 800000ULL
typedef enum ebpf_socket_idx {
NETDATA_KEY_CALLS_TCP_SENDMSG,
@@ -42,6 +42,7 @@ typedef enum ebpf_socket_idx {
} ebpf_socket_index_t;
#define NETDATA_SOCKET_GROUP "Socket"
+#define NETDATA_NETWORK_CONNECTIONS_GROUP "Network connections"
// Global chart name
#define NETDATA_TCP_FUNCTION_COUNT "tcp_functions"
@@ -56,6 +57,13 @@ typedef enum ebpf_socket_idx {
#define NETDATA_NET_APPS_BANDWIDTH_SENT "bandwidth_sent"
#define NETDATA_NET_APPS_BANDWIDTH_RECV "bandwidth_recv"
+// Network viewer charts
+#define NETDATA_NV_OUTBOUND_BYTES "outbound_bytes"
+#define NETDATA_NV_OUTBOUND_PACKETS "outbound_packets"
+#define NETDATA_NV_OUTBOUND_RETRANSMIT "outbound_retransmit"
+#define NETDATA_NV_INBOUND_BYTES "inbound_bytes"
+#define NETDATA_NV_INBOUND_PACKETS "inbound_packets"
+
// Port range
#define NETDATA_MINIMUM_PORT_VALUE 1
#define NETDATA_MAXIMUM_PORT_VALUE 65535
@@ -91,6 +99,8 @@ typedef struct ebpf_network_viewer_port_list {
uint16_t cmp_first;
uint16_t cmp_last;
+
+ uint8_t protocol;
struct ebpf_network_viewer_port_list *next;
} ebpf_network_viewer_port_list_t;
@@ -125,10 +135,12 @@ typedef struct ebpf_network_viewer_hostname_list {
struct ebpf_network_viewer_hostname_list *next;
} ebpf_network_viewer_hostname_list_t;
+#define NETDATA_NV_CAP_VALUE 50L
typedef struct ebpf_network_viewer_options {
uint32_t max_dim; // Store value read from 'maximum dimensions'
- uint32_t name_resolution_enabled;
+ uint32_t hostname_resolution_enabled;
+ uint32_t service_resolution_enabled;
ebpf_network_viewer_port_list_t *excluded_port;
ebpf_network_viewer_port_list_t *included_port;
@@ -158,11 +170,30 @@ typedef struct netdata_socket {
uint64_t first; // First timestamp
uint64_t ct; // Current timestamp
uint16_t retransmit; // It is never used with UDP
- uint8_t protocol; // Should this to be in the index?
+ uint8_t protocol;
uint8_t removeme;
uint32_t reserved;
} netdata_socket_t __attribute__((__aligned__(8)));
+
+typedef struct netdata_plot_values {
+ // Values used in the previous iteration
+ uint64_t recv_packets;
+ uint64_t sent_packets;
+ uint64_t recv_bytes;
+ uint64_t sent_bytes;
+ uint16_t retransmit;
+
+ uint64_t last_time;
+
+ // Values used to plot
+ uint64_t plot_recv_packets;
+ uint64_t plot_sent_packets;
+ uint64_t plot_recv_bytes;
+ uint64_t plot_sent_bytes;
+ uint16_t plot_retransmit;
+} netdata_plot_values_t;
+
/**
* Index used together previous structure
*/
@@ -178,6 +209,8 @@ typedef struct netdata_socket_idx {
#define NETDATA_DOTS_PROTOCOL_COMBINED_LENGTH 5 // :TCP:
#define NETDATA_DIM_LENGTH_WITHOUT_SERVICE_PROTOCOL 979
+#define NETDATA_INBOUND_DIRECTION (uint32_t)1
+#define NETDATA_OUTBOUND_DIRECTION (uint32_t)2
/**
* Allocate the maximum number of structures in the beginning, this can force the collector to use more memory
* in the long term, on the other had it is faster.
@@ -187,26 +220,39 @@ typedef struct netdata_socket_plot {
avl avl;
netdata_socket_idx_t index;
- // Updated data
+ // Current data
netdata_socket_t sock;
+ // Previous values and values used to write on chart.
+ netdata_plot_values_t plot;
+
int family; // AF_INET or AF_INET6
char *resolved_name; // Resolve only in the first call
unsigned char resolved;
char *dimension_sent;
char *dimension_recv;
+ char *dimension_retransmit;
+
+ uint32_t flags;
} netdata_socket_plot_t;
+#define NETWORK_VIEWER_CHARTS_CREATED (uint32_t)1
typedef struct netdata_vector_plot {
- netdata_socket_plot_t *plot;
+ netdata_socket_plot_t *plot; // Vector used to plot charts
+
+ avl_tree_lock tree; // AVL tree to speed up search
+ uint32_t last; // The 'other' dimension, the last chart accepted.
+ uint32_t next; // The next position to store in the vector.
+ uint32_t max_plot; // Max number of elements to plot.
+ uint32_t last_plot; // Last element plot
- avl_tree_lock tree;
- uint32_t last;
- uint32_t next;
+ uint32_t flags; // Flags
} netdata_vector_plot_t;
extern void clean_port_structure(ebpf_network_viewer_port_list_t **clean);
+extern ebpf_network_viewer_port_list_t *listen_ports;
+extern void update_listen_table(uint16_t value, uint8_t proto);
#endif