Packaged MIBs#

SNMP command responder discovers pip-installed packages extending the snmpresponder.mibs entry point.

The main advantage of packaged MIBs is easier distribution. That might make more sense for generally useful and reusable MIB implementations such as HOST-RESOURCES-MIB.

This example configuration includes example Python package, which could be used as a blueprint for packaging other MIB implementations.

You could test this configuration by running the following command (you may need to have COFFEE-POT-MIB installed locally):

$ snmpget -v2c -c public COFFEE-POT-MIB::potName.0

SNMP Command Responder is configured to:

  • listen on UDP socket at localhost

  • form a MIB tree out of all objects imported from the examples extension point (provided by installed snmpresponder-mibs-examples package)

  • respond to SNMPv2c queries

  • serve all queries against the configured MIB tree

# SNMP Command Responder configuration file

config-version: 1
program-name: snmpresponder

snmp-credentials-group {

  snmp-engine-id: 0x0102030405070809

  snmp-community-name: public
  snmp-security-name: public
  snmp-security-model: 2
  snmp-security-level: 1

  snmp-credentials-id: snmp-credentials

context-group {
  snmp-context-engine-id-pattern: .*?
  snmp-context-name-pattern: .*?

  snmp-context-id: any-context

content-group {
  snmp-pdu-type-pattern: .*?
  snmp-pdu-oid-prefix-pattern-list: .*?

  snmp-content-id: any-content

peers-group {
  snmp-bind-address-pattern-list: .*?
  snmp-peer-address-pattern-list: .*?

  snmp-peer-id: 100

managed-objects-group {

  # List of Python packages to import in the MIB builder context
  mib-code-packages-pattern-list: examples\..*

  mib-tree-id: managed-objects-1

routing-map {
  matching-snmp-context-id-list: any-context
  matching-snmp-content-id-list: any-content

  matching-snmp-credentials-id-list: snmp-credentials
  matching-snmp-peer-id-list: 100

  using-mib-tree-id: managed-objects-1

Download configuration file.

The only implemented, read-only managed object is COFFEE-POT-MIB::potName.0:

  • serves a static value for COFFEE-POT-MIB::potName.0 object

  • only SNMP read operations are implemented

  • write operation are allowed, but has no effect

"""SNMP MIB module (COFFEE-POT-MIB) expressed in pysnmp data model.

This Python module is designed to be imported and executed by the
pysnmp library.

See for further information.

ASN.1 source
Produced by pysmi-0.4.0 at Sat Jan 12 14:01:57 2019
On host igarlic platform Darwin version 17.7.0 by user ilya
Using Python version 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13)
if 'mibBuilder' not in globals():
    import sys


mibBuilder = globals()['mibBuilder']

MibScalarInstance, = mibBuilder.importSymbols(

# Import Managed Objects to base Managed Objects Instances on

potName, = mibBuilder.importSymbols(

# MIB Managed Objects in the order of their OIDs

class PotnameObjectInstance(MibScalarInstance):
    """Scalar Managed Object Instance with MIB instrumentation hooks.

    User can override none, some or all of the method below interfacing
    them to the data source they want to manage through SNMP.
    Non-overridden methods could just be removed from this class.

    See the SMI data model documentation at ``.
    def readTest(self, varBind, **context):
        cbFun = context['cbFun']
        cbFun(varBind, **context)

    def readGet(self, varBind, **context):
        name, value = varBind

        cbFun = context['cbFun']
        value = self.syntax.clone('mypot')
        cbFun((name, value), **context)

    def readTestNext(self, varBind, **context):
        name, value = varBind

        if name >=
            MibScalarInstance.readTestNext(self, varBind, **context)

            cbFun = context['cbFun']
            cbFun((, value), **context)

    def readGetNext(self, varBind, **context):
        name, value = varBind

        if name >=
            MibScalarInstance.readGetNext(self, varBind, **context)

            value = self.syntax.clone('mypot')

            cbFun = context['cbFun']
            cbFun((, value), **context)

_potName = PotnameObjectInstance(,

# Export Managed Objects Instances to the MIB builder

    **{"potName": _potName}

Download MIB implementation.

For more information on MIB implementation refer to the MIB implementation chapter in the documentation.