From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: netfilter@vger.kernel.org
Subject: Re: How to obtain KBytes/sec in/out from a rule in real time
Date: Fri, 8 Jun 2012 13:33:01 +0100 [thread overview]
Message-ID: <20120608123301.GA13651@chaz.gmail.com> (raw)
In-Reply-To: <20120608003037.0ud7f668g84kgk4c@correo.co.cr>
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
prev parent reply other threads:[~2012-06-08 12:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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=20120608123301.GA13651@chaz.gmail.com \
--to=stephane.chazelas@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).