Locating and Viewing the Contents of Linux MIBs



Locating and Viewing the Contents of Linux MIBs

Residing in memory, MIBs are data structures that are constantly updated via the SNMP daemon. The MIB configuration text files are located on your hard disk and loaded into memory each time SNMP restarts.

You can easily find your Fedora Linux MIBs by using the locate command and filtering the output to include only values with the word "snmp" in them. As you can see in this case, the MIBs are located in the /usr/share/snmp/mibs directory:

     [root@bigboy tmp]# locate mib | grep snmp
     /usr/share/doc/net-snmp-5.0.6/README.mib2c
     /usr/share/snmp/mibs
     /usr/share/snmp/mibs/DISMAN-SCHEDULE-MIB.txt
     ...
     ...
     [root@bigboy tmp]#

As the MIB configurations are text files you can search for keywords in them using the grep command. This example searches for the MIBs that keep track of TCP connections and returns the RFC1213 and TCP MIBs as the result.

     [root@silent mibs]# grep -i tcp /usr/share/snmp/mibs/*.txt \
       | grep connections
     ...
     RFC1213-MIB.txt: "The limit on the total number of TCP connections
     RFC1213-MIB.txt: "The number of times TCP connections have made a
     ...
     TCP-MIB.txt:     "The number of times TCP connections have made a
     ...
     ...
     [root@silent mibs]#

You can use the vi editor to look at the MIBs. Don't change them, because doing so could cause SNMP to fail. MIBs are very complicated, but fortunately the key sections are commented.

Each value tracked in a MIB is called an object and is often referred to by its object ID or OID. In this snippet of the RFC1213-MIB.txt file, you can see that querying the tcpActiveOpens object returns the number of active open TCP connections to the server. The SYNTAX field shows that this is a counter value.

MIBs usually track two types of values. Counter values are used for items that continuously increase as time passes, such as the amount of packets passing through a NIC or amount of time the CPU has been busy since boot time. Integer values change instant by instant and are useful for tracking such statistics as the amount of memory currently being used.

     tcpActiveOpens OBJECT-TYPE
         SYNTAX  Counter
         ACCESS  read-only
         STATUS  mandatory
         DESCRIPTION
                 "The number of times TCP connections have made a
                 direct transition to the SYN-SENT state from the
                 CLOSED state."
         ::= { tcp 5 }

You'll explore the differences between SNMP and MRTG terminologies in more detail later. Understanding them will be important in understanding how to use MRTG to track MIB values.