question on netstat statistics.

Jeremy Chadwick freebsd at jdc.parodius.com
Tue Nov 15 00:32:24 UTC 2011


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 at banshee ~]# ifconfig -l
> igb0 igb1 lo0 lagg0 lagg0.53 lagg0.52 pflog0 lagg0.66
> [root at banshee ~]# for int in $(ifconfig -l) ; do netstat -I $int -s -f
> inet; done
> [root at 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 at 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 at ostracod.unsane.co.uk:/usr/obj/usr/src/sys/OSTRACOD  amd64
> [root at ostracod ~]#
> FreeBSD banshee.namesco.net 8.2-STABLE FreeBSD 8.2-STABLE #5: Wed Nov  2
> 14:53:03 GMT 2011    
> toor at 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 at 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 |



More information about the freebsd-stable mailing list