Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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 } '
share|improve this answer
    
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 '12 at 14:30
    
Many distributions separate the utilities from the server. What distribution are you using? –  Kyle Smith Apr 3 '12 at 14:44
    
Centos and RHEL net-snmp is installed. –  nibb11 Apr 3 '12 at 14:48
    
Looks like snmptable is provided by net-snmp-utils. Try that one out. –  Kyle Smith Apr 3 '12 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 '12 at 15:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.