Oidview

Network monitoring, SNMP and network management guides from Oidview

What Is a MIB and How It Maps to OIDs

Written by

Published

Filed under

SNMP MIB

Wondering what an SNMP MIB actually is? It is a text file that gives names and meanings to the numeric OIDs a device exposes, so you can read “sysName” instead of a string of digits.

Item Value
MIB language standard SMIv2, RFC 2578 (April 1999)
Root of the standard management subtree mib-2 = { mgmt 1 }
System group (RFC 3418, December 2002) { mib-2 1 }, i.e. 1.3.6.1.2.1.1
sysName position { system 5 }, i.e. 1.3.6.1.2.1.1.5
sysName syntax DisplayString (SIZE (0..255))

These figures come from RFC 2578 and RFC 3418. Standards get revised, so check the sources before you rely on them.

What a MIB is

A Management Information Base is a module that describes the objects a device can report or accept changes to. The SNMP protocol only moves values around; the MIB tells you what each value means.

Think of it as a data dictionary. Without it, a manager receives a number and a value and has to guess what they stand for. With it, the same reply reads as a named object with a known type, a known unit and a known access level.

MIBs are written in an adapted subset of ASN.1, defined by SMIv2. Each object is declared with a macro that, in the RFC’s words, is used “to concisely convey the syntax and semantics of a managed object.”

If you are new to the protocol itself, start with the overview of SNMP, then come back here.

How a MIB maps to OIDs

Every object lives in a global tree, and its OID is the path of numbers from the root. The MIB is what attaches a name to each node on that path.

SMIv2 defines the top of the tree step by step. Each line says “this name is child N of that parent”:

  • org is { iso 3 }, and dod is { org 6 }
  • internet is { dod 1 }, and mgmt is { internet 2 }
  • mib-2 is { mgmt 1 }

Walk that chain and mib-2 becomes 1.3.6.1.2.1. Everything in the standard MIB-II area hangs below it.

The same idea repeats at every level. A group is a child of mib-2, an object is a child of a group, and a table is an object whose children describe rows and columns. Reading an OID left to right is the same as walking down the tree one named step at a time.

Reading one object definition

Take sysName from RFC 3418. It is declared with a syntax, an access level, a status and a description, then closed with its position in the tree.

  1. SYNTAX: DisplayString (SIZE (0..255)), a text value with a length limit.
  2. MAX-ACCESS: read-write, so a manager may set it.
  3. STATUS: current.
  4. DESCRIPTION: “An administratively-assigned name for this managed node.”
  5. Last line: ::= { system 5 }.

That last line is the mapping. The system group is { mib-2 1 }, so sysName is 1.3.6.1.2.1.1.5.

Each clause answers a practical question. SYNTAX tells your tool how to decode the value, MAX-ACCESS tells you whether you can change it, STATUS tells you whether the object is still in use, and DESCRIPTION tells a human what it is for.

SNMP MIB optical fibers
A fan of thin strands glows in several colors against a black background.

Standard MIBs and vendor MIBs

Standard modules such as SNMPv2-MIB cover things every device has: description, uptime, contact, name and location. Vendors publish their own modules for features the standards do not cover, such as fan speeds or licence counters.

To use a vendor module, load it into your SNMP tool along with any modules it imports. Without it, you still get answers, but they show up as bare numbers.

Modules refer to each other through imports. If a vendor file imports symbols from another module that your tool has not loaded, the load fails or the names stay unresolved. Loading the standard modules first, then the vendor file, is the usual fix.

Tables, scalars and notifications

MIBs describe more than single values. A scalar object holds one value for the whole device, such as its name. A table holds one row per thing the device has, such as each network interface, with a column for every property.

The MIB defines the table, its row entry, the columns and the index that picks one row. Your tool combines the column’s OID with the index to address a single cell. That is why walking a table returns long lists of related OIDs that differ only at the end.

The same SMIv2 standard also defines a NOTIFICATION-TYPE macro. It describes unsolicited messages a device can send, and which objects ride along with them.

In practice, you will meet three kinds of object in most modules:

  • Scalars, which give a single fact about the device.
  • Tables, which list repeated items such as interfaces or sensors.
  • Notifications, which describe events the device announces by itself.

Common problems when loading MIBs

Most trouble comes from files that do not match what the device runs. A firmware update can add objects the old module does not know, and an old module can mention objects the device never implemented.

Treat the MIB as a description of what a device may offer, not a guarantee. A walk of the device itself shows what it actually answers.

  1. Confirm the module name and version in the file header against the vendor’s documentation.
  2. Load the modules it imports before loading the module itself.
  3. Test with a single known object, such as sysName, before walking a whole branch.
  4. If a name will not resolve, fall back to the numeric OID and compare it with the file.

Following these steps in order keeps a failed load from hiding the real cause, which is usually a missing import rather than a broken file.

Why MIBs matter in daily work

A MIB turns raw output into something you can read and alert on. It also records whether an object is read-only or writable, which is worth checking before you try to change a value.

Access to writable objects is usually controlled by credentials, covered in the SNMP community string guide. Notifications are defined in MIBs too, and the SNMP trap page shows how devices send them.

A few habits make MIBs easier to live with:

  • Keep one folder of MIB files and point every tool at it.
  • Check an object’s STATUS before you build a dashboard on it, since deprecated or obsolete objects may disappear.
  • Read the DESCRIPTION for units and edge cases, such as what an empty value means.
  • Use the numeric OID in scripts when a name might not resolve on another machine.

Frequently asked questions

Is a MIB the same as an OID?

Show answer

No. An OID is the numeric address of one object. A MIB is the file that names many OIDs and describes their types and meanings.

Do I need a MIB to query a device?

Show answer

Not strictly. Numeric OIDs work without one, but the output is harder to read and types are less clear.

What language are MIBs written in?

Show answer

An adapted subset of ASN.1, as defined by SMIv2 in RFC 2578.

Where do vendor-specific objects go?

Show answer

Vendors define them in their own modules, placed under their own branch of the OID tree rather than in the standard mib-2 area.