Search code examples
snmpnet-snmp

How to get and set OID value in custom SNMP MIB


I am very new to SNMP and I need to get "system uptime" using our own enterprise OID.

I have already obtained an IANA number and created a MIB file.

The problem is when I use snmpget command with our OID, I get an object not found error at the command prompt.

Although when I do a snmptranslate on our object, I get the exact OID of that object.

If any additional information is required from my side, please let me know.


Solution

  • When you use snmpget, an SNMP request is made via IP to an SNMP agent on a remote (or local) host to return a specific piece of data. A MIB is used to describe in human readable terms, what that data is and where to find it. On the other hand, snmptranslate is a tool used to parse a given MIB. It parses a local MIB file, and doesn't make any contact with an agent.

    Since you mentioned creating a new MIB, I assume your trying to add new functionality to an SNMP agent. To do this, the agent must be extended. If you're using Net-SNMP, there are a few options including compiling new source code into the agent, using a sub-agent, and using external scripts via pass and pass-persist protocol. Take a look at: