PySNMP MIBs

raw JSON →
0.1.6 verified Fri May 01 auth: no python

A collection of IETF & IANA MIBs pre-compiled for PySNMP. Version 0.1.6 is the latest release (last updated 2023). No active maintenance; releases are infrequent.

pip install pysnmp-mibs
error Missing MIB: 'No MIB found matching given OID'
cause The MIB you are trying to use is not included in pysnmp-mibs.
fix
Install additional MIBs via PySMI compilation or use absolute numeric OIDs.
error AttributeError: module 'pysnmp_mibs' has no attribute 'endOfMibView'
cause Importing symbols from pysnmp-mibs instead of pysnmp.
fix
Use from pysnmp.proto.rfc1902 import endOfMibView.
error pysnmp_mibs not found
cause pysnmp-mibs not installed or installed in a different environment.
fix
Run pip install pysnmp-mibs in the same Python environment.
gotcha pysnmp-mibs only contains pre-compiled MIBs. It does not support runtime MIB compilation; you must install the MIB files separately if you need custom MIBs.
fix Use pysnmp-mibs for standard IETF/IANA MIBs. For custom MIBs, use pysnmp's MIBCompiler or install PySMI.
gotcha Symbols like endOfMibView, noSuchInstance are part of pysnmp, not pysnmp-mibs. Attempting to import them from pysnmp-mibs will fail.
fix Import from pysnmp.proto.rfc1902 or other pysnmp modules.
gotcha Not all MIBs from IETF/IANA are included. Some MIBs may be missing or outdated. There is no easy way to see the full list without exploring the package.
fix Check the PyPI package contents or the GitHub repo for the list of bundled MIBs.

Basic SNMP GET using pysnmp + pysnmp-mibs. MIB resolution is automatic if pysnmp-mibs is installed.

from pysnmp.hlapi import *
from pysnmp.smi import builder

getCmd(SnmpEngine(),
       CommunityData('public'),
       UdpTransportTarget(('demo.snmplabs.com', 161)),
       ContextData(),
       ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)))