Re: How to obtain KBytes/sec in/out from a rule in real time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux