How to pass MIB to the Manager

  1. How to make use of random MIBs at my Manager application?
  1. Starting from PySNMP 4.3.x, plain-text (ASN.1) MIBs can be automatically parsed into PySNMP form by the PySMI tool. PySNMP will call PySMI automatically, parsed PySNMP MIB will be cached in $HOME/.pysnmp/mibs/ (default location).

    MIB compiler could be configured to search for plain-text MIBs at multiple local and remote locations. As for remote MIB repos, you are welcome to use our collection of ASN.1 MIB files at as shown below.

from pysnmp.hlapi import *

errorIndication, errorStatus, errorIndex, varBinds = next(
           UdpTransportTarget(('', 161)),
           ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets', 1).addAsn1MibSource('file:///usr/share/snmp',

if errorIndication:
elif errorStatus:
    print('%s at %s' % (errorStatus.prettyPrint(),
                        errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
    for varBind in varBinds:
        print(' = '.join([x.prettyPrint() for x in varBind]))

Download script.

Alternatively, you can invoke the (shipped with PySMI) by hand and this way compile plain-text MIB into PySNMP format.