How I get the number of (currently) established TCP connections in prometheus (kubernetes monitoring)
To get number of currently open TCP connections, you can use node_netstat_Tcp_CurrEstab
(Gauge) metric.
you can also use node_netstat_Tcp_ActiveOpens
(Counter) metrics with appropriate rate such as
rate(node_netstat_Tcp_ActiveOpens[10m])
These metrics are based on TCP-MIB (RFC-4022) and they are obtained by parsing /proc/net/netstat
and /proc/net/tcp
files on every node running exporter.