Writing a coherent and usable MIB module

Tuesday, July 29th, 2014

The process involved in designing an SNMP agent can be challenging and despite the meaning of its acronym, SNMP is far from simple.

Given its popularity and maturity as a protocol, there is plenty of online information to help an unexperienced but motivated software engineer produce a working SNMP agent. However it would most likely lack the usability aspect required by the people actually using it in the field and fail to maintain coherence over the duration of its useful life.

The MIB module should be designed with great care to guarantee usability and coherence. SNMP is considered to be a machine to machine (M2M) protocol and has a very limited number of variable types. Good SNMP managers are designed to transform the information in order to present them in a human-readable manner so some familiarization with commercial SNMP managers is important.

It is paramount to adequately match the nature of objects to be exposed to the correct SNMP type. For instance, the sequence variable type is often overlooked but should be considered wherever a two-dimension table would simplify the overall scheme. New textual types should be added wherever needed to make the transition from machine to human easier to read. Units should be defined wherever relevant and hints should be given for formatting information (e.g. decimal point location). Some comments are also read by SNMP managers to extend the limited SMI syntax.    

The chosen OID numbering should take into account not only the current set of requirements but also make room for future enhancements and allow for others product to easily fit into the MIB at a later stage. A MIB module must always be back compatible. This is to allow older agent to co-exist with new ones on a particular system.  

The design of the trap framework is an area where the designer has some choice but again, it needs to be usable and fit the application. There are two main approaches, defining one trap OID per event or using the ITU X.733 model where a single trap OID contains several human-readable varbinds describing the type of event (see http://www.ietf.org/proceedings/50/I-D/disman-itualarm-mib-01.txt).  

From a practical point of view, new MIB modules should be written in SMIv2 and be validated using an online tool such as http://www.simpleweb.org/ietf/mibs/validate/.

< Back to Blog