Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Frank Wunderlich <frank-w@public-files.de>
Cc: netfilter@vger.kernel.org
Subject: Re: nft show counter
Date: Wed, 31 Mar 2021 23:40:53 +0200	[thread overview]
Message-ID: <20210331214053.GB13699@breakpoint.cc> (raw)
In-Reply-To: <trinity-08431e16-b4eb-4bb7-8b36-df2084481611-1617212862528@3c-app-gmx-bap62>

Frank Wunderlich <frank-w@public-files.de> wrote:
> Hi,
> 
> i want to read counters defined in nftables, but have not found a solid way to do this
> 
> nft list table ip filter
> 
> shows me the rules from specific table with all chains, rules and counters, e.g.
> 
> 	chain voip1 {
> 		counter packets 3226 bytes 780864 accept
> 	}
> 
> 	chain voip2 {
> 		counter packets 1640 bytes 119449 accept
> 	}
> 
> this needs to be parsed with grep/sed/awk, so maybe there is an easier way to read the counters. found nothing in manpage or google, so i just ask here. maybe there is a way to show the last x min traffic. i need this to check if connections is "alive"

You could use a named counter and then fetch it via 'nft list counter
inet tablenam countername'.

  parent reply	other threads:[~2021-03-31 21:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31 17:47 nft show counter Frank Wunderlich
2021-03-31 21:23 ` Frank Myhr
2021-03-31 21:40 ` Florian Westphal [this message]
2021-03-31 23:08   ` Frank Myhr
2021-04-01  8:08     ` Aw: " Frank Wunderlich
2021-04-01 16:42       ` Anton Rieger
2021-04-02 17:16         ` Frank Myhr
2021-04-02 17:42           ` Frank Wunderlich
2021-04-03 17:04             ` Frank Myhr
2021-04-02 22:22           ` Anton Rieger
2021-04-01 18:14       ` Florian Westphal
2021-04-01 18:31         ` Frank Wunderlich
2021-04-01 20:03           ` Florian Westphal
2021-04-02 11:58         ` Aw: " Frank Wunderlich
2021-04-02 17:10           ` Frank Myhr
2021-04-01 18:21     ` Florian Westphal
2021-07-22 19:57   ` manual : CONNTRACK EXPRESSIONS pauloric
2021-07-23 15:00     ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210331214053.GB13699@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=frank-w@public-files.de \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox