AW: ethernet statistics

Dan Nelson dnelson at allantgroup.com
Thu Sep 25 15:52:12 UTC 2008


In the last episode (Sep 25), Vonarburg, David said:
> netstat -i is ok for a user to get system statictics. I'd like get
> exactly this information but as a function call inside a "C" language
> application

netstat -i still digs into kernel memory to get those stats, I think,
so you can't directly access those numbers as a regular user.  You can
shell out and parse the output of "netstat -i", or do some snmp queries
to your local net-snmp daemon.  Checking the dev.em.0.stats sysctl node
is another option, and gives you some more hardware status counters
than netstat, but not all drivers support it (em does so you're okay).

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list