netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to obtain KBytes/sec in/out from a rule in real time
@ 2012-06-08  6:30 José Pablo Pérez
  2012-06-08 12:33 ` Stephane Chazelas
  0 siblings, 1 reply; 2+ messages in thread
From: José Pablo Pérez @ 2012-06-08  6:30 UTC (permalink / raw)
  To: netfilter

HellO!

Anybody know if a tool or script exists out there to obtain the
KBytes/sec in/out from a rule in real time

In other words something that can parse something like this:

# iptables -L INET_IN_PORT -v -x
# iptables -L INET_IN_PORT -v -x -n

Thanks!

-JP


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to obtain KBytes/sec in/out from a rule in real time
  2012-06-08  6:30 How to obtain KBytes/sec in/out from a rule in real time José Pablo Pérez
@ 2012-06-08 12:33 ` Stephane Chazelas
  0 siblings, 0 replies; 2+ messages in thread
From: Stephane Chazelas @ 2012-06-08 12:33 UTC (permalink / raw)
  To: netfilter

2012-06-08 00:30:37 -0600, José Pablo Pérez:
> HellO!
> 
> Anybody know if a tool or script exists out there to obtain the
> KBytes/sec in/out from a rule in real time
> 
> In other words something that can parse something like this:
> 
> # iptables -L INET_IN_PORT -v -x
> # iptables -L INET_IN_PORT -v -x -n
[...]

You could do things like:

a=$(tput clear) perl -e 'while (1) {
  open IT, "-|", "iptables", "-vxnL", "INPUT";
   $. = 0; print $ENV{a};
   while (<IT>) {
      s{^\s*(\d+)\s+(\d+)}{
        $n = ($1-$a[$.]) . " " . ($2-$b[$.]);
        $a[$.]=$1;
        $b[$.] = $2;
        $n
      }e;
      print
   };
   close IT;
   sleep 1}'

as a first approximation.

-- 
Stephane


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-08 12:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-08  6:30 How to obtain KBytes/sec in/out from a rule in real time José Pablo Pérez
2012-06-08 12:33 ` Stephane Chazelas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).