Logo
Home page Net-SNMP

Archive Search:

Require all words?

Site Search:
Google
MFD : ifTable testing

MFD : ifTable testing

If you have not been compiling as you went along, try and compile now.

$ make -f ifTable_Makefile

After running make, you should have an executable named ifTable.

Starting the agent

You can run the ifTable agent as a regular SNMP agent, or as an AgentX sub-agent. The default is to run as a sub-agent. While testing, the -f (do not fork into background) and -L (log to stderr) options are recommended.

AgentX Sub-agent: ifTable -f -L
Standard SNMP Agent: ifTable -M -f -L [udp[:port]]

Note that running the sub-agent application as a master agent will runwithout any access control. All SNMPv1 and SNMPv2c requests will be accepted, regardless of the community string.

For that reason, when testing I run as a regular user (not root), and only bind to the localhost interface, like so:

$./ifTable -f -L -DifTable -M localhost:1161
2004-04-21 21:51:47 ifTable:init_ifTable: Registering ifTable as a mibs-for-dummies table.
2004-04-21 21:51:48 ifTable: using linux 2.2 kernel /proc/net/dev
            

Querying the agent

A simple snmpwalk will quickly test the module:

$snmpwalk -v1 localhost:1161 ifTable
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifIndex.2 = INTEGER: 2
IF-MIB::ifIndex.3 = INTEGER: 3
IF-MIB::ifDescr.1 = STRING: 
IF-MIB::ifDescr.2 = STRING: 
IF-MIB::ifDescr.3 = STRING: 
IF-MIB::ifType.1 = INTEGER: softwareLoopback(24)
IF-MIB::ifType.2 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.3 = INTEGER: tunnel(131)
IF-MIB::ifPhysAddress.1 = STRING: 0:0:0:0:0:0
IF-MIB::ifPhysAddress.2 = STRING: 0:30:65:cd:a3:c8
IF-MIB::ifPhysAddress.3 = STRING: 0:0:0:0:0:0
IF-MIB::ifInOctets.1 = Counter32: 51368348
IF-MIB::ifInOctets.2 = Counter32: 2666605618
IF-MIB::ifInOctets.3 = Counter32: 0
IF-MIB::ifInUcastPkts.1 = Counter32: 415774
IF-MIB::ifInUcastPkts.2 = Counter32: 13971039
IF-MIB::ifInUcastPkts.3 = Counter32: 0
IF-MIB::ifInDiscards.1 = Counter32: 0
IF-MIB::ifInDiscards.2 = Counter32: 0
IF-MIB::ifInDiscards.3 = Counter32: 0
IF-MIB::ifInErrors.1 = Counter32: 0
IF-MIB::ifInErrors.2 = Counter32: 0
IF-MIB::ifInErrors.3 = Counter32: 0
IF-MIB::ifOutOctets.1 = Counter32: 51370076
IF-MIB::ifOutOctets.2 = Counter32: 879325033
IF-MIB::ifOutOctets.3 = Counter32: 0
IF-MIB::ifOutUcastPkts.1 = Counter32: 415798
IF-MIB::ifOutUcastPkts.2 = Counter32: 8046959
IF-MIB::ifOutUcastPkts.3 = Counter32: 0
IF-MIB::ifOutDiscards.1 = Counter32: 0
IF-MIB::ifOutDiscards.2 = Counter32: 0
IF-MIB::ifOutDiscards.3 = Counter32: 0
IF-MIB::ifOutErrors.1 = Counter32: 0
IF-MIB::ifOutErrors.2 = Counter32: 0
IF-MIB::ifOutErrors.3 = Counter32: 0
IF-MIB::ifSpecific.3 = No more variables left in this MIB View (It is past the end of the MIB tree)

If you ran the agent with debugging, you should see something like this:

$./ifTable -f -L -DifTable -M localhost:1161
2004-04-21 21:51:47 ifTable:init_ifTable: Registering ifTable as a mibs-for-dummies table.
2004-04-21 21:51:48 ifTable: using linux 2.2 kernel /proc/net/dev
            

Next: TBD | Back: Data get | Up: IF-MIB Tutorials
rstory at freesnmp dot com
Version $Revision$

Valid CSS!


Last modified: Wednesday, 01-Aug-2018 04:41:28 UTC
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.