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
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.
Gauge
metrics such as node_netstat_Tcp_CurrEstab
. You will get only value that Prometheus asked for (usually every 30sec). So that's exact situation where counter metric (such as node_netstat_Tcp_ActiveOpens
) comes handy. If you plot it in graph, you will got increase over time and don't miss moment where process opened bunch of connections just after scrape of metric was done –
Somewise © 2022 - 2024 — McMap. All rights reserved.