From 204164e4e44cea0d1db041a72f525c90781f823c Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Thu, 4 Jun 2020 08:41:53 +0200 Subject: [PATCH] Include TCP OutRsts in netstat metrics TCP "OutRsts" is the number of TCP Resets sent by the node. This can be useful for monitoring connection failures and flooding. Signed-off-by: Ben Kochie --- CHANGELOG.md | 2 +- collector/fixtures/e2e-64k-page-output.txt | 3 +++ collector/fixtures/e2e-output.txt | 3 +++ collector/netstat_linux.go | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f32b944c0..36a1ad79e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ * [CHANGE] * [FEATURE] -* [ENHANCEMENT] +* [ENHANCEMENT] Include TCP OutRsts in netstat metrics * [BUGFIX] ## 1.0.0 / 2020-05-25 diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 3e9f6cb9c1..fe32915bfc 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -1886,6 +1886,9 @@ node_netstat_Tcp_InErrs 5 # HELP node_netstat_Tcp_InSegs Statistic TcpInSegs. # TYPE node_netstat_Tcp_InSegs untyped node_netstat_Tcp_InSegs 5.7252008e+07 +# HELP node_netstat_Tcp_OutRsts Statistic TcpOutRsts. +# TYPE node_netstat_Tcp_OutRsts untyped +node_netstat_Tcp_OutRsts 1003 # HELP node_netstat_Tcp_OutSegs Statistic TcpOutSegs. # TYPE node_netstat_Tcp_OutSegs untyped node_netstat_Tcp_OutSegs 5.4915039e+07 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index df04679d28..0edc65bbd9 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -1955,6 +1955,9 @@ node_netstat_Tcp_InErrs 5 # HELP node_netstat_Tcp_InSegs Statistic TcpInSegs. # TYPE node_netstat_Tcp_InSegs untyped node_netstat_Tcp_InSegs 5.7252008e+07 +# HELP node_netstat_Tcp_OutRsts Statistic TcpOutRsts. +# TYPE node_netstat_Tcp_OutRsts untyped +node_netstat_Tcp_OutRsts 1003 # HELP node_netstat_Tcp_OutSegs Statistic TcpOutSegs. # TYPE node_netstat_Tcp_OutSegs untyped node_netstat_Tcp_OutSegs 5.4915039e+07 diff --git a/collector/netstat_linux.go b/collector/netstat_linux.go index 9b4be49fb3..60bdbeaf8e 100644 --- a/collector/netstat_linux.go +++ b/collector/netstat_linux.go @@ -34,7 +34,7 @@ const ( ) var ( - netStatFields = kingpin.Flag("collector.netstat.fields", "Regexp of fields to return for netstat collector.").Default("^(.*_(InErrors|InErrs)|Ip_Forwarding|Ip(6|Ext)_(InOctets|OutOctets)|Icmp6?_(InMsgs|OutMsgs)|TcpExt_(Listen.*|Syncookies.*|TCPSynRetrans)|Tcp_(ActiveOpens|InSegs|OutSegs|PassiveOpens|RetransSegs|CurrEstab)|Udp6?_(InDatagrams|OutDatagrams|NoPorts|RcvbufErrors|SndbufErrors))$").String() + netStatFields = kingpin.Flag("collector.netstat.fields", "Regexp of fields to return for netstat collector.").Default("^(.*_(InErrors|InErrs)|Ip_Forwarding|Ip(6|Ext)_(InOctets|OutOctets)|Icmp6?_(InMsgs|OutMsgs)|TcpExt_(Listen.*|Syncookies.*|TCPSynRetrans)|Tcp_(ActiveOpens|InSegs|OutSegs|OutRsts|PassiveOpens|RetransSegs|CurrEstab)|Udp6?_(InDatagrams|OutDatagrams|NoPorts|RcvbufErrors|SndbufErrors))$").String() ) type netStatCollector struct {