Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

network interface monitor

Status
Not open for further replies.

jlynch1

Technical User
Dec 20, 2001
100
0
0
IE
I have a linux based router. (standard pc hardware with 2 NICs). I want to be able to graph the rate of data that passes through each network interface over a short period of about 5-10 mins. I would need to find out the rate of data passing through the network interfaces every 10 seconds or so.

Im new to SNMP and dont know much about it. I have set up MRTG with SNMP to graph the throughput through the router. But I need to able to monitor the traffic passing through at a finer granualarity. How does MRTG calculate the rate of traffic passing through an interface at a given time. Is there a byte counter that can be accessed through snmp?

I know iptables can be used with the following options -nvxL to show the number of packets that have passed through the firewall. This could be used to calculate the rate but Im looking for a better solution if there is one.

Can anyone help me out ?
 
The oids you need are the ifInOctets and ifOutOctets counters for each interface you want to measure.
As the name implies, they count octets (effectively bytes) going in and out of each interface. As these are 32 bit counters, they can cycle quite often on busy interfaces, so you will probably need to watch for that in any program you write.
These oids are in the IF-MIB in the mib-2 branch of the SNMP tree, and pretty well all network devices support them.
The full numeric names are:

.1.3.6.1.2.1.2.2.1.10 -- ifInOctets
.1.3.6.1.2.1.2.2.1.16 -- ifOutOctets

You will need to look at other oids in the ifEntry table to make sure you know which interface you are looking at (eg ifPhysAddress for MAC address)


IfEntry ::=
SEQUENCE {
ifIndex InterfaceIndex,
ifDescr DisplayString,
ifType IANAifType,
ifMtu Integer32,
ifSpeed Gauge32,
ifPhysAddress PhysAddress,
ifAdminStatus INTEGER,
ifOperStatus INTEGER,
ifLastChange TimeTicks,
ifInOctets Counter32,
ifInUcastPkts Counter32,
ifInNUcastPkts Counter32, -- deprecated
ifInDiscards Counter32,
ifInErrors Counter32,
ifInUnknownProtos Counter32,
ifOutOctets Counter32,
ifOutUcastPkts Counter32,
ifOutNUcastPkts Counter32, -- deprecated
ifOutDiscards Counter32,
ifOutErrors Counter32,
ifOutQLen Gauge32, -- deprecated
ifSpecific OBJECT IDENTIFIER -- deprecated
}

Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top