From owner-freebsd-stable@FreeBSD.ORG Tue Nov 15 00:32:24 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 816EB1065674 for ; Tue, 15 Nov 2011 00:32:24 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from qmta02.emeryville.ca.mail.comcast.net (qmta02.emeryville.ca.mail.comcast.net [76.96.30.24]) by mx1.freebsd.org (Postfix) with ESMTP id 6A7D88FC17 for ; Tue, 15 Nov 2011 00:32:24 +0000 (UTC) Received: from omta08.emeryville.ca.mail.comcast.net ([76.96.30.12]) by qmta02.emeryville.ca.mail.comcast.net with comcast id xCY91h0090FhH24A2CYGrk; Tue, 15 Nov 2011 00:32:16 +0000 Received: from koitsu.dyndns.org ([67.180.84.87]) by omta08.emeryville.ca.mail.comcast.net with comcast id xCXd1h01a1t3BNj8UCXeDe; Tue, 15 Nov 2011 00:31:38 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id CC250102C1D; Mon, 14 Nov 2011 16:32:22 -0800 (PST) Date: Mon, 14 Nov 2011 16:32:22 -0800 From: Jeremy Chadwick To: Vincent Hoffman Message-ID: <20111115003222.GA82751@icarus.home.lan> References: <4EC1AAAE.1030007@unsane.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4EC1AAAE.1030007@unsane.co.uk> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: FreeBSD Stable Mailing List Subject: Re: question on netstat statistics. X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2011 00:32:24 -0000 On Mon, Nov 14, 2011 at 11:56:30PM +0000, Vincent Hoffman wrote: > I've been trying to work out why my nfs mounts seem to be a little speed > limited (thats another email though) and though I'd go through the stats > netstat makes available. > >From the manpage > > netstat -i | -I interface -s [-f protocol_family | -p protocol] [-M > core] > [-N system] > Display per-interface statistics for each network protocol, > for a > particular protocol_family, or for a single protocol. > > > I was expecting to be able to see at least some tcp/ip stats per > interface, but > [root@banshee ~]# ifconfig -l > igb0 igb1 lo0 lagg0 lagg0.53 lagg0.52 pflog0 lagg0.66 > [root@banshee ~]# for int in $(ifconfig -l) ; do netstat -I $int -s -f > inet; done > [root@banshee ~]# > > I can get system wide using netstat -s -f inet and if use netstat -I > $int -s I get a bunch of ipv6 stats. > and of course i can get the stats from netstat -I $int too. > > Is this expected behaviour? if so maybe the manpage could be made a > little clearer. > > Thanks, > Vince > > ps tested on > [root@ostracod ~]# uname -a > FreeBSD ostracod.unsane.co.uk 9.0-RC1 FreeBSD 9.0-RC1 #15 r226879: Fri > Oct 28 22:25:26 BST 2011 > toor@ostracod.unsane.co.uk:/usr/obj/usr/src/sys/OSTRACOD amd64 > [root@ostracod ~]# > FreeBSD banshee.namesco.net 8.2-STABLE FreeBSD 8.2-STABLE #5: Wed Nov 2 > 14:53:03 GMT 2011 > toor@banshee.lon.domain.com:/usr/obj/usr/src/sys/BANSHEE amd64 > > FreeBSD zfstest 9.0-RC2 FreeBSD 9.0-RC2 #0 r227497M: Mon Nov 14 16:14:54 > GMT 2011 toor@zfstest:/usr/obj/usr/src/sys/ZFSTEST amd64 On my system: netstat -s = returns system-wide statistics for all IP-related bits netstat -I {iface} = returns network I/O statistics and related bits associated with that interface netstat -I {iface} -s = returns nothing (no output) netstat -I {iface} -f inet = same as "netstat -I {iface}" but only with IPv4 specific data netstat -I {iface} -s -f inet = returns nothing (no output) I think what you're actually looking for is, BTW: netstat -I em0 -inbd And if you want real-time I/O rates: netstat -I em0 -bd 1 Where "1" is the number of seconds between polling iterations. I don't particularly care what the man page says, I just know what works. :-) If you're wanting "netstat -s" output but on a per-interface basis, those statistics are not tracked per-interface. Maybe netgraph can do that for you, I do not know. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, US | | Making life hard for others since 1977. PGP 4BD6C0CB |