I am using this command in linux to see (currently) established TCP connections:
netstat -ant | grep ESTABLISHED | wc -l
How can i translate this command to PromQL (per node) ?
I am using prometheus with node exporter in my kubernetes cluster
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.