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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OID questions 1

Status
Not open for further replies.

snickered

IS-IT--Management
Jul 28, 2006
2
US
I decided to dive into the wonderful world of SNMP. I installed Crypt-DES and Net-SNMP for Perl. I checked out the examples that came with the packages and executed them. In the example I used the OID was 1.3.6.1.2.1.1.3.0 for sysUpTime. I started looking at OIDs on this website: and I thought I hit a snag because I would drill down to one that I wanted to try and it wouldn't work. For instance, I tried sysName which is: 1.3.6.1.2.1.1.5. I tried over and over then I decided to stick a 0 at the end. It worked!! Now I really thought I could browse around just pick an OID. Then I came to another one that didn't work with my magical 0 at the end. This OID was: 1.3.6.1.2.1.2.2.1.14 (ifInErrors). I stuck the 0 at the end and no go!?! I tried this thing with a 1 and it works. It actually works with a 2 and other numbers at the end as well. My question is... how do you guys read these OID databases and choose the right OID for your programs? TIA.
 
snmpwalk. The index number is often needed. There's no index "0" for your interfaces, they start at 1.

"snmpwalk -c <community> localhost ifinerrors" lists them out:
IF-MIB::ifInErrors.1 = Counter32: 0
IF-MIB::ifInErrors.2 = Counter32: 0
IF-MIB::ifInErrors.3 = Counter32: 0
IF-MIB::ifInErrors.4 = Counter32: 0
IF-MIB::ifInErrors.5 = Counter32: 0

Then you can snmpget the individual ones. You can snmpwalk ifdescr to find the ones you really want:

IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0
IF-MIB::ifDescr.3 = STRING: eth1
IF-MIB::ifDescr.4 = STRING: sit0
IF-MIB::ifDescr.5 = STRING: ppp0
 
So, basically the .x at the end is for the interface? And I guess a .0 at the end means the entire system? Which is good for things like hostname(sysName) and uptime(sysUpTime). Thanks for your reply.

 
snickered,

Just for clarification:

The MIB items that are accessed by using .0 at the end are SCALAR MIB items which basically means they are single entities or items. E.g. sysName. There is only one of them.

For the other items you talk about accessed by .1 .2 .3 etc. These are SNMP table items and the identifier you are adding on the end is the index entry into the table. e.g. .1 is the first item, .2 is the second item , etc. In the case of the ifDescr entries the INDEX is ifIndex.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top