From owner-freebsd-questions@FreeBSD.ORG Wed Jan 11 18:00:35 2012 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 CE860106566B for ; Wed, 11 Jan 2012 18:00:35 +0000 (UTC) (envelope-from kes-kes@yandex.ru) Received: from forward8.mail.yandex.net (forward8.mail.yandex.net [IPv6:2a02:6b8:0:202::3]) by mx1.freebsd.org (Postfix) with ESMTP id E64BF8FC0A for ; Wed, 11 Jan 2012 18:00:34 +0000 (UTC) Received: from smtp6.mail.yandex.net (smtp6.mail.yandex.net [77.88.61.56]) by forward8.mail.yandex.net (Yandex) with ESMTP id 7930CF6297E; Wed, 11 Jan 2012 22:00:10 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1326304810; bh=xoUG+h5qNYCYKPNcdoaD/SmF4O/Rgbv/15xCNs6WwW8=; h=Date:From:Reply-To:Message-ID:To:CC:Subject:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding; b=B+SFf39Uj+pyIphNpKxDcnWuWvE3ntQrwPjgyoNdebNT4Sf2id8PXT256utWgoMkf gW8HAvnR3o/kSyxzwzFgfmLNVKxhWa0uIJ+78d/TH2MJENDr13g8fEJ2id+TJsveAy EHA+ljfrAKUmdDhl9cT9qTUUUSmg7WdFMSQQKXiM= Received: from smtp6.mail.yandex.net (localhost [127.0.0.1]) by smtp6.mail.yandex.net (Yandex) with ESMTP id 544D5164033B; Wed, 11 Jan 2012 22:00:10 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1326304810; bh=xoUG+h5qNYCYKPNcdoaD/SmF4O/Rgbv/15xCNs6WwW8=; h=Date:From:Reply-To:Message-ID:To:CC:Subject:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding; b=B+SFf39Uj+pyIphNpKxDcnWuWvE3ntQrwPjgyoNdebNT4Sf2id8PXT256utWgoMkf gW8HAvnR3o/kSyxzwzFgfmLNVKxhWa0uIJ+78d/TH2MJENDr13g8fEJ2id+TJsveAy EHA+ljfrAKUmdDhl9cT9qTUUUSmg7WdFMSQQKXiM= Received: from unknown (unknown [77.93.52.19]) by smtp6.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 09609erd-0A6ORYfd; Wed, 11 Jan 2012 22:00:10 +0400 X-Yandex-Spam: 1 Date: Wed, 11 Jan 2012 20:00:08 +0200 From: =?utf-8?B?0JrQvtC90YzQutC+0LIg0JXQstCz0LXQvdC40Lk=?= X-Mailer: The Bat! (v4.0.24) Professional Organization: =?utf-8?B?0KfQnyDQmtC+0L3RjNC60L7QsiwgRnJlZUxpbmU=?= X-Priority: 3 (Normal) Message-ID: <1934957060.20120111200008@yandex.ru> To: Mike Woods In-Reply-To: <20120111112400.Horde.g4QFfgcXel9PDXFQSwJwfrA@webmail.geofront.co.uk> References: <20120111112400.Horde.g4QFfgcXel9PDXFQSwJwfrA@webmail.geofront.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: 8bit Cc: freebsd-questions@freebsd.org Subject: Re: Network throughput X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: =?utf-8?B?0JrQvtC90YzQutC+0LIg0JXQstCz0LXQvdC40Lk=?= List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 18:00:36 -0000 Здравствуйте, Mike. Вы писали 11 января 2012 г., 13:24:00: MW> Hi guys, Been a while since i've had need to post to the list :) MW> I'm trying to gather network throughput information on a box of ours MW> and I'm having a little problem, the throughput is to be measured on a MW> per-minute basis and i've been trying to use netstat for this (count MW> now - count before/timeperiod) however netstats byte counter resets MW> far too quickly to be usefull (this is a busy gb link), i've had a MW> look at vnstat but this only seems to operation on an hour or higher MW> and I need to get down to the minute, does anyone have any suggestions MW> of a tool better suited to this ? snmp will help #!/usr/bin/perl use warnings; use strict; my $snmpauth= $ARGV[0]; #auth string like '-v 1 passhere', supplied asis to snmpget my $host= $ARGV[1]; # my $ifIndex= $ARGV[2]; #interface name or index if( !$ifIndex ) { print `/usr/local/bin/snmpwalk $snmpauth $host .`; exit 0; } #print `/usr/local/bin/snmpwalk $snmpauth $host IF-MIB::ifName`; if( $ifIndex =~ /^[a-zA-Z]/ ) { #print "/usr/local/bin/snmpwalk $snmpauth $host IF-MIB::ifName"; `/usr/local/bin/snmpwalk $snmpauth $host IF-MIB::ifName` =~ /\.(\d+).+$ifIndex/; $ifIndex= $1; } my $octetsIn= `/usr/local/bin/snmpget $snmpauth -O qv $host .1.3.6.1.2.1.31.1.1.1.6.$ifIndex`; chop $octetsIn; #IF-MIB::ifHCInOctets my $octetsOut= `/usr/local/bin/snmpget $snmpauth -O qv $host .1.3.6.1.2.1.31.1.1.1.10.$ifIndex`; chop $octetsOut; #IF-MIB::ifHCOutOctets my $packetsIn= `/usr/local/bin/snmpget $snmpauth -O qv $host .1.3.6.1.2.1.2.2.1.11.$ifIndex`; chop $packetsIn; #IF-MIB::ifInUcastPkts my $packetsOut= `/usr/local/bin/snmpget $snmpauth -O qv $host .1.3.6.1.2.1.2.2.1.17.$ifIndex`; chop $packetsOut;#IF-MIB::ifOutUcastPkts print "octetsIn:$octetsIn octetsOut:$octetsOut packetsIn:$packetsIn packetsOut:$packetsOut\n"; -- С уважением, Коньков mailto:kes-kes@yandex.ru