Date: Wed, 11 Jan 2012 20:00:08 +0200 From: =?utf-8?B?0JrQvtC90YzQutC+0LIg0JXQstCz0LXQvdC40Lk=?= <kes-kes@yandex.ru> To: Mike Woods <mike@geofront.co.uk> Cc: freebsd-questions@freebsd.org Subject: Re: Network throughput Message-ID: <1934957060.20120111200008@yandex.ru> In-Reply-To: <20120111112400.Horde.g4QFfgcXel9PDXFQSwJwfrA@webmail.geofront.co.uk> References: <20120111112400.Horde.g4QFfgcXel9PDXFQSwJwfrA@webmail.geofront.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
Здравствуйте, 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1934957060.20120111200008>