Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Nov 2011 16:32:22 -0800
From:      Jeremy Chadwick <freebsd@jdc.parodius.com>
To:        Vincent Hoffman <vince@unsane.co.uk>
Cc:        FreeBSD Stable Mailing List <freebsd-stable@freebsd.org>
Subject:   Re: question on netstat statistics.
Message-ID:  <20111115003222.GA82751@icarus.home.lan>
In-Reply-To: <4EC1AAAE.1030007@unsane.co.uk>
References:  <4EC1AAAE.1030007@unsane.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
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 |




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