Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jun 2013 01:09:17 -0400
From:      Mark Johnston <markj@freebsd.org>
To:        Kenta Suzumoto <kentas@hush.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Per-IP Bandwidth Monitoring
Message-ID:  <20130609050917.GA31573@raichu>
In-Reply-To: <20130609023211.D8E42200EA@smtp.hushmail.com>
References:  <20130607174701.9DAA0400EA@smtp.hushmail.com> <51B2228F.1000008@llaisdy.com> <20130607184536.4A4D7400EA@smtp.hushmail.com> <144D087B-9396-4FD5-90DD-2F7A29D9E55F@llaisdy.com> <20130609023211.D8E42200EA@smtp.hushmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jun 08, 2013 at 10:32:11PM -0400, Kenta Suzumoto wrote:
> Hello. I'm running a FreeBSD machine with 5 IP addresses, each of them attached to a specific jail. I'm wondering if there is an easy way to monitor the bandwidth usage of each of them individually. Upon googling, I ran into a lot of suggestions like bandwidthd. I gave it a try and it seemed very broken and basically didn't work at all. I'm basically looking for a "vnstat that works per IP instead of per interface" kind of thing. jnettop wasn't what I was looking for. It doesn't have to make pretty graphs(but that's nice too), just human-readable text is fine. Anyone have a recommendation?

I'm not clear on what exactly you're after, but it seems like you should
be able to get the info you need using the DTrace ip provider. This
provider isn't available in FreeBSD yet, but a patch for it is at [1].
To use it, you'll need to recompile the kernel with my changes and then
install the ip.d file from the patch to /usr/lib/dtrace.

Once that's done, you can try the example script at [2] on your jail
host. It just tracks the number of sent and received bytes per local IP
address, and prints the totals every second. That's just an example
presentation though - the point is that collecting this kind of info is
pretty trivial with DTrace. The downside is that such scripts may hurt
your throughput since they cause the kernel to execute some extra code
for every packet sent and received through the IP stack. The actual
performance hit will depend on the script.

-Mark

[1] http://people.freebsd.org/~markj/patches/providers/ip-provider.diff

[2] http://people.freebsd.org/~markj/monitor.d



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130609050917.GA31573>