# NoMethodError for SNMP::MIB.oid (newby!)

**URL:** <https://www.ruby-forum.com/t/nomethoderror-for-snmp-mib-oid-newby/81321>\
**Category:** Ruby\
**Created:** [January 7, 2007, 7:07pm UTC](https://www.ruby-forum.com/t/nomethoderror-for-snmp-mib-oid-newby/81321 "2007-01-07T19:07:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobyr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ebca7d/32.png) [@tobyr](https://www.ruby-forum.com/u/tobyr)\
**Post date:** [January 7, 2007, 7:07pm UTC](https://www.ruby-forum.com/t/nomethoderror-for-snmp-mib-oid-newby/81321/1 "2007-01-07T19:07:39Z")

</div>

I’m using the snmp library for Ruby. My programs are very basic and are  
developments of the example scripts in the documentation. At the moment  
I’m trying to get an OID and thought that to do that I could use  
SNMP::MIB.oid()  
but I get a ‘NoMethodError’ even though the oid method clearly does  
exist. What gives? Thanks in advance!

PS What I’m actually try to do is to give “ifDescr” and get  
1.3.6.1.2.1.2.2.1.2 in return.

---

<div class="post-metadata">

**Author:** ![tobyr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ebca7d/32.png) [@tobyr](https://www.ruby-forum.com/u/tobyr)\
**Post date:** [January 8, 2007, 12:17am UTC](https://www.ruby-forum.com/t/nomethoderror-for-snmp-mib-oid-newby/81321/2 "2007-01-08T00:17:05Z")

</div>

“Physician, [part] heal thyself”

Well, the reason why I was getting the NoMethodError was because I was  
trying to use it as a class method whereas it is in fact an instance  
method. So what I needed was something like:

newMib = SNMP::MIB.new  
newMib.load\_module(“IF-MIB”)

wantedOid = newMib.oid(“ifIndex”)

… but there’s got to be quicker way of doing that surely!
