From this question Statistics /proc/net/stat/nf_conntrack is missing on Linux server I recognized that /proc/net/stat/nf_conntrack
has an alternative conntrack -S
.
In /proc/net/stat/nf_conntrack there is NEW
counter, based on which the one can calculate CPS (connections per second) metric. But in conntrack -S
I see no such a counter.
How can I obtain the NEW
conntrack counter without /proc/net/stat/nf_conntrack
? Is there a way to obtain it from conntrack -S
?
The kernel part displaying such statistics in the
/proc
filesystem method is there:as can be seen, fields
searched
(replaced by an other field in later kernels),new
,delete
,delete_list
always display 0: nothing feeds these fields.As I suspected in my previous answer ("or might have been obsoleted") there is no statistic about this with the older method or the newer method.
Here is the commit from 2016 that removed them (probably for kernel 4.9):
Alternative
You can use the conntrackd tool (packaged on Ubuntu there) that can be configured to log events to provide only logs and statistics (instead of its main use for transparent failover between multiple firewalls in a high availability cluster). Ubuntu might be providing a configuration for statistics by default (or in documentation). Here's an example on a system where the
conntrackd
service is running:The tool tells
connections created:
went from 121807 to 121811. I believe that's the equivalent of thenew
field removed from kernel.Note:
traffic processed:
is certainly for firewall-to-firewall communication between two conntrackd daemons (so will always be 0 here).