@@ -22,7 +22,9 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
22
22
(void )dt ;
23
23
24
24
static int do_bandwidth = -1 , do_inerrors = -1 , do_mcast = -1 , do_bcast = -1 , do_mcast_p = -1 , do_bcast_p = -1 , do_ecn = -1 , \
25
- do_tcpext_reorder = -1 , do_tcpext_syscookies = -1 , do_tcpext_ofo = -1 , do_tcpext_connaborts = -1 , do_tcpext_memory = -1 ;
25
+ do_tcpext_reorder = -1 , do_tcpext_syscookies = -1 , do_tcpext_ofo = -1 , do_tcpext_connaborts = -1 , do_tcpext_memory = -1 ,
26
+ do_tcpext_listen = -1 ;
27
+
26
28
static uint32_t hash_ipext = 0 , hash_tcpext = 0 ;
27
29
static procfile * ff = NULL ;
28
30
@@ -93,6 +95,10 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
93
95
static unsigned long long tcpext_TCPAbortOnLinger = 0 ; // connections aborted after user close in linger timeout
94
96
static unsigned long long tcpext_TCPAbortFailed = 0 ; // times unable to send RST due to no memory
95
97
98
+ // https://perfchron.com/2015/12/26/investigating-linux-network-issues-with-netstat-and-nstat/
99
+ static unsigned long long tcpext_ListenOverflows = 0 ; // times the listen queue of a socket overflowed
100
+ static unsigned long long tcpext_ListenDrops = 0 ; // SYNs to LISTEN sockets ignored
101
+
96
102
// IPv4 TCP memory pressures
97
103
static unsigned long long tcpext_TCPMemoryPressures = 0 ;
98
104
@@ -116,6 +122,7 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
116
122
do_tcpext_ofo = config_get_boolean_ondemand ("plugin:proc:/proc/net/netstat" , "TCP out-of-order queue" , CONFIG_BOOLEAN_AUTO );
117
123
do_tcpext_connaborts = config_get_boolean_ondemand ("plugin:proc:/proc/net/netstat" , "TCP connection aborts" , CONFIG_BOOLEAN_AUTO );
118
124
do_tcpext_memory = config_get_boolean_ondemand ("plugin:proc:/proc/net/netstat" , "TCP memory pressures" , CONFIG_BOOLEAN_AUTO );
125
+ do_tcpext_listen = config_get_boolean_ondemand ("plugin:proc:/proc/net/netstat" , "TCP listen issues" , CONFIG_BOOLEAN_AUTO );
119
126
120
127
arl_ipext = arl_create ("netstat/ipext" , NULL , 60 );
121
128
arl_tcpext = arl_create ("netstat/tcpext" , NULL , 60 );
@@ -197,6 +204,11 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
197
204
arl_expect (arl_tcpext , "TCPMemoryPressures" , & tcpext_TCPMemoryPressures );
198
205
}
199
206
207
+ if (do_tcpext_listen != CONFIG_BOOLEAN_NO ) {
208
+ arl_expect (arl_tcpext , "ListenOverflows" , & tcpext_ListenOverflows );
209
+ arl_expect (arl_tcpext , "ListenDrops" , & tcpext_ListenDrops );
210
+ }
211
+
200
212
// shared metrics
201
213
arl_expect (arl_tcpext , "TCPSynRetrans" , & tcpext_TCPSynRetrans );
202
214
}
@@ -682,6 +694,40 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
682
694
rrdset_done (st_syncookies );
683
695
}
684
696
697
+ // --------------------------------------------------------------------
698
+
699
+ if (do_tcpext_listen == CONFIG_BOOLEAN_YES || (do_tcpext_listen == CONFIG_BOOLEAN_AUTO && (tcpext_ListenOverflows || tcpext_ListenDrops ))) {
700
+ do_tcpext_listen = CONFIG_BOOLEAN_YES ;
701
+
702
+ static RRDSET * st_listen = NULL ;
703
+ static RRDDIM * rd_overflows = NULL , * rd_drops = NULL ;
704
+
705
+ if (unlikely (!st_listen )) {
706
+
707
+ st_listen = rrdset_create_localhost (
708
+ "ipv4"
709
+ , "tcplistenissues"
710
+ , NULL
711
+ , "tcp"
712
+ , NULL
713
+ , "TCP Listen Socket Issues"
714
+ , "packets/s"
715
+ , 3015
716
+ , update_every
717
+ , RRDSET_TYPE_LINE
718
+ );
719
+
720
+ rd_overflows = rrddim_add (st_listen , "ListenOverflows" , "overflows" , 1 , 1 , RRD_ALGORITHM_INCREMENTAL );
721
+ rd_drops = rrddim_add (st_listen , "ListenDrops" , "drops" , 1 , 1 , RRD_ALGORITHM_INCREMENTAL );
722
+ }
723
+ else
724
+ rrdset_next (st_listen );
725
+
726
+ rrddim_set_by_pointer (st_listen , rd_overflows , tcpext_ListenOverflows );
727
+ rrddim_set_by_pointer (st_listen , rd_drops , tcpext_ListenDrops );
728
+
729
+ rrdset_done (st_listen );
730
+ }
685
731
}
686
732
}
687
733
0 commit comments