Note: Much of this tutorial requires ucd-snmp-4.2.2 or higher!, so make sure you get it before running the commands found in this tutorial.
Note: A new tutorial for net-snmp 5.0 and above is available as well. The commands is
the ucd-snmp specific tutorial will not work as expected if you
are using net-snmp and not ucd-snmp.
The snmptranslate tool is a very powerful tool that allows you to browse the MIB tree in various ways from the command line.
In its simplest form, it merely translates a textual oid into a numerical one:
It can also translate into textual as well, by adding the -On flag to its options
Note that the argument passed can describe a OID in any fashion, and the -On flag merely toggles which type of output is displayed:
Note how the oid was abbreviated for you? You can change this behaviour as well with -Of (most useful with the -On flag too):
The last two commands started with '.' in the beginning of the oid. This is because they were a fully qualified OID starting from the very root of the tree (.1 == .iso).
The first three commands make use of the default prefix that assumes if you don't start with a '.' at the beginning you want a sub section of the mib2 tree. You can change the default prefix by setting the environmental variable PREFIX to be the one you would rather use.
The problem with the above commands is that you have to remember the entire OID for what you're looking for, even with the nice prefix. Now, we wouldn't be a very good package if we didn't provide some sort of random lookup function right? Well, the good news is that we do. -IR nicely does this for us, and searches the MIB tree for the node you want:
Finally, starting with version 4.1, it'll even try to do regex pattern matching to find the exact node you want given only a piece of its name by using the -Ib (best match) option:
To get a list of all the nodes that match a given pattern, use the -TB flag:
To get extended information about a mib node, use the -Td (description) flag:
Finally, last but certainly not least, if you want a pretty diagram of a section of the mib tree, check out the -Tp flag:
As a homework assignment, we'll leave it up to you to run
snmptranslate -Tp without an oid argument, which prints the
known MIB tree in its entirety.
Last modified: Wednesday, 01-Aug-2018 04:41:28 UTC
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.