From owner-freebsd-questions@FreeBSD.ORG Thu Sep 25 15:52:12 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 939A0106568B for ; Thu, 25 Sep 2008 15:52:12 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.freebsd.org (Postfix) with ESMTP id 563398FC19 for ; Thu, 25 Sep 2008 15:52:11 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.3/8.14.3) with ESMTP id m8PFqAhQ056760 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 25 Sep 2008 10:52:10 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.3/8.14.3/Submit) id m8PFq8XN056748; Thu, 25 Sep 2008 10:52:08 -0500 (CDT) (envelope-from dan) Date: Thu, 25 Sep 2008 10:52:07 -0500 From: Dan Nelson To: "Vonarburg, David" Message-ID: <20080925155203.GB3284@dan.emsphone.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 7.1-PRERELEASE User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Erik Osterholm , freebsd-questions@freebsd.org Subject: Re: AW: ethernet statistics X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Sep 2008 15:52:12 -0000 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@allantgroup.com