1

Does someone know how to get a interface number for SNMP for nic cards? And how or with what, a SNMP walk?

I have some cards which have the same OID in SNMP but change the port randomly. I was wondering if there was a command I could send from Windows or Linux to get the interface numbers or list all interfaces with their ports like this: Found standard interfaces:

1: (001) lo,Connected,10 MBit/s,Software Loopback,
2: (002) eth0,Connected,100 MBit/s,Ethernet,
3: (003) eth1,Not Connected,0 KBit/s,Ethernet,

Thanks

1 Answer 1

3

SNMP tables are ordered by an index that can change between systems and reboots. For this reason you should always look up the index values of tables that can have multiple entries before looking up associated statistics and not rely solely on the OID remaining static.

That being said, snmptable will do this for you in a pinch!

snmptable -v2c -c <community string> <hostname> IF-MIB::ifTable

There are many more columns that you'd like so you could clean up the results with awk, like so:

snmptable -CH -v2c -c <community string> <hostname> IF-MIB::ifTable | awk 'BEGIN { OFS="," } { print $1, $2, $3, $5 } '
8
  • Thanks but I get command not found on a Linux box when I run "snmptable". I have the service installed and running on the box but the one I run the command and so the one Im connecting to. And the service is working since I get data via SNMP from a monitoring platform from them.
    – nibb11
    Apr 3, 2012 at 14:30
  • Many distributions separate the utilities from the server. What distribution are you using?
    – Kyle Smith
    Apr 3, 2012 at 14:44
  • Centos and RHEL net-snmp is installed.
    – nibb11
    Apr 3, 2012 at 14:48
  • Looks like snmptable is provided by net-snmp-utils. Try that one out.
    – Kyle Smith
    Apr 3, 2012 at 14:59
  • OK I got one for windows and commands works except for the one you posted. I think the syntax is wrong.
    – nibb11
    Apr 3, 2012 at 15:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .