SNMP, MIBs, OIDs, and Net-SNMP
How the identifiers in this browser relate to devices, and how to query them using the same MIB directory layout used by Observium.
The pieces
- SNMP
- The protocol used by a manager such as Observium to read data from, and receive notifications from, an agent on a device.
- OID
- A numeric identifier such as
.1.3.6.1.2.1.2.2.1.8. An OID identifies a definition or a particular indexed instance. - MIB
- A definition file that gives OIDs names, types, descriptions, table structure, and enumerated values. A MIB does not contain live device data.
- Net-SNMP
- The command-line tools Observium invokes to communicate with SNMP agents and translate named MIB objects.
Observium MIB paths
A standard Observium installation stores MIBs below
/opt/observium/mibs. RFC and Net-SNMP definitions are
normally in:
/opt/observium/mibs/rfc
/opt/observium/mibs/net-snmp
Vendor definitions use directories such as
/opt/observium/mibs/cisco. The generated commands put the
directory selected in this browser first. This matters when a vendor
and an RFC directory contain different modules with the same name.
Net-SNMP’s -M option supplies the ordered directory list;
-m selects the module to load. If Observium is installed
somewhere other than /opt/observium, replace that prefix
with the configured installation directory.
Which command should I use?
| Command | Use it for |
|---|---|
snmptranslate |
Translate a named object to its numeric OID or inspect its MIB definition. It does not contact a device. |
snmpget |
Read one complete instance, such as a scalar ending in .0 or a table column followed by its indexes. |
snmpbulkwalk |
Read the instances beneath a table, column, row, or subtree efficiently with SNMP v2c or v3. |
snmpwalk |
Walk a subtree without GETBULK, chiefly for SNMP v1 or devices whose agents have broken bulk-walk support. |
Examples
/usr/bin/snmptranslate -Pud -Ir -On -m 'IF-MIB' -M '/opt/observium/mibs/rfc:/opt/observium/mibs/net-snmp' 'IF-MIB::ifOperStatus'
/usr/bin/snmpget -v2c -c '<community>' -Pud -Ir -OQUv -m 'SNMPv2-MIB' -M '/opt/observium/mibs/rfc:/opt/observium/mibs/net-snmp' 'udp:<hostname>:161' 'SNMPv2-MIB::sysUpTime.0'
/usr/bin/snmpbulkwalk -v2c -c '<community>' -Pud -Ir -OQUs -m 'IF-MIB' -M '/opt/observium/mibs/rfc:/opt/observium/mibs/net-snmp' 'udp:<hostname>:161' 'IF-MIB::ifTable'
Replace the angle-bracket placeholders before running a device query. The examples use SNMP v2c for brevity; use your device’s configured version, transport, credentials, timeout, and retry settings.
Scalars and table indexes
A scalar definition is not itself an instance. Its single value
uses the .0 suffix:
SNMPv2-MIB::sysUpTime.0.
A table column can have many instances. Append every index in the
order declared by its row—for example
IF-MIB::ifOperStatus.<ifIndex>—or walk the
column first to discover available indexes.
Notifications are different
A notification or trap is sent by an agent to a receiver; it is
not a stored value that can be fetched with snmpget
or enumerated with snmpwalk.
Use snmptranslate -Td to inspect its definition and
varbind list. Receiving notifications requires a configured
receiver such as snmptrapd; this differs from
Observium’s normal polling of device OIDs.
SNMP versions and security
- SNMPv1 is legacy and cannot use GETBULK.
- SNMPv2c is widely supported, but its community is transmitted without encryption.
- SNMPv3 can authenticate and encrypt requests and should be preferred where devices support it.
- Treat community strings, SNMPv3 authentication data, and privacy keys as secrets. Do not paste real credentials into public URLs or support tickets.
- Restrict SNMP access with device ACLs and firewalls; do not expose UDP port 161 broadly to the Internet.
Common errors
Cannot find module |
The required MIB file or one of its imports is absent from the directories passed with -M. |
|---|---|
Unknown Object Identifier |
The module was not loaded, the wrong variant won directory precedence, or the object name is not declared by that module. |
No Such Object |
The device agent does not implement that definition in the requested context. |
No Such Instance |
The scalar lacks .0, a table index is incomplete, or that particular row is absent. |
| Timeout | Check reachability, UDP port 161, ACLs, credentials, SNMP version, context, timeout, and retry settings. |