Systems and Network Management An Introduction to the SNMP Protocol: The MIB Tree 1 Background: The Net SNMP programs are available from http://net-snmp.sourceforge.net/. They implement the snmp protocol versions 1, 2 and 3. They also provide an snmp library, which you can use in applications, written in a number of languages. There is also a Perl binding to this library, called SNMP. These tools are useful particularly since they implement aspects of the protocol in a simple, understandable way, and are ideal for learning about the snmp protocol. 1.1 The MIB Tree We use snmp to get values from, and to set values in managed objects. These managed objects are arranged so that each has an Object ID, or oid. The oid has two representations: a series of numbers separated by dots, or a series of names, also separated by dots. These oids are arranged in a tree structure, called the MIB tree. The abbreviation mib stands for Management Information Base. Figure 1.2 The MIB Files The mib tree structure is described in a set of files on your hard disk, in the directory /usr/share/snmp/mibs. We will study the structure of these mib files in later exercises. Each of these mib files contains descriptions of a set of managed objects that an agent can provide. The tool snmptranslate can query the information in these files, and can show information about the mib tree. 1.3 Agent and Manager request manager response agent device Figure 1: A manager sends an snmp request to an agent, which responds to the manager. Figure Nick Urbanik ver. 1.4 An Introduction to the SNMP Protocol: The MIB Tree Systems and Network Management 2 2 Procedure: You can either boot your own copy of Linux, or boot the Linux that is installed on the internal hard disk of the computers in the laboratory for this exercise, since we are not modifying any snmp objects today. 2.1 Learning about the SNMP MIB Tree with snmptranslate $ snmptranslate .1.3.6.1.2.1.1.3.0 You will see the text form of this object id (oid). 1. Open a command prompt, and type: 2. snmptranslate can also translate into numerical form as well, by adding the -On flag to its options (that is the letter “Oh”, not a zero). Type this at your command prompt: $ snmptranslate -On SNMPv2-MIB::system.sysUpTime.0 3. You can mix text and numbers when you describe an oid; the -On flag just toggles which type of output is displayed. Compare the output of each of: $ snmptranslate .iso.3.6.1.private.enterprises.2021.2.1.prNames.0 and $ snmptranslate -On .iso.3.6.1.private.enterprises.2021.2.1.prNames.0 4. Normally the oid output is abbreviated (shorter). You can change this behaviour with -Of: $ snmptranslate -Of .iso.3.6.1.private.enterprises.2021.2.1.prNames.0 5. The problem with the above commands is that you have to remember the entire oid for what you’re looking for. The -IR option (“random access lookup”) searches the mib tree for the node you want: $ snmptranslate sysUpTime.0 Invalid object identifier: sysUpTime.0 So try this instead: $ snmptranslate -IR sysUpTime.0 6. You can use regular expressions to find the exact node you want given only a piece of its name by using the -Ib (best match) option: $ snmptranslate -Ib 'sys.*ime' Nick Urbanik ver. 1.4 An Introduction to the SNMP Protocol: The MIB Tree Systems and Network Management 3 7. To get a list of all the nodes that match a given pattern, use the -TB flag: $ snmptranslate -TB 'vacm.*table' 8. To get extended information about a mib node, use the -Td (description) flag: $ snmptranslate -On -Td -Ib 'sys.*ime' 9. To see a diagram of a section of the mib tree, use the -Tp flag: $ snmptranslate -Tp SNMPv2-MIB::system This is useful to explore the mib tree. 10. Run snmptranslate -Tp without an oid argument. This prints the entire mib tree from all the mib files. I suggest pipe the output into less. Nick Urbanik ver. 1.4