Developing SMUX peers for SNMP agents

MIB modules

The first task in implementing an SMUX peer is to create the MIB module that the peer registers. It contains the variables used to configure or administer the device to be managed. This section describes how to define a MIB module and compile it so that the peer can read it. It also describes the syntax of a compiled module.

Defining MIB modules

First, write a MIB module to define the actual managed objects which the SMUX peer is to manage. RFC 1212 ``Concise MIB Definitions'' defines a format for writing MIB modules; you may find it a useful place to start While describing these rules is not within the scope of this chapter, you may find some of the following basic information helpful.

Define the MIB module in a file called *.my; for the reference peer, the file is called MIB modules fall into 3 broad categories:

  1. If you are defining a MIB module for something specific to a UNIX system, it should probably go under the BSD UNIX MIB. Contact Marshall Rose or Keith Sklower to get a number under the UNIX enterprise tree; refer to ``References'' for address information. In this case, the definition might start something like this:
              SendMail-MIB { iso(1) org(3) dod(6) internet(1) private(4)
                             enterprises(1) unix (4) sendmail (99) }


    IMPORTS unix --*, OBJECT-TYPE *-- FROM RFC1155-SMI;

    sendMail OBJECT IDENTIFIER ::= { unix 99 }

  2. If you are defining a MIB module on a multilateral, experimental basis (for example, for a protocol like the NTP), then you should contact the Internet Assigned Numbers Authority ( and ask for an experimental number. In this case, the definition might start something like this:

    IMPORTS experimental, OBJECT-TYPE FROM RFC1155-SMI;

    foo OBJECT IDENTIFIER ::= { experimental 99 }

  3. In most cases, you will be defining a MIB module for something specific to your enterprise. You should contact the Internet Assigned Numbers Authority ( and ask for an enterprise number (assuming you don't already have one). In this case, the definition might begin as does our example in

    IMPORTS enterprises, OBJECT-TYPE FROM RFC1155-SMI;

    foo OBJECT IDENTIFIER ::= { enterprises 9999 }

In any event, the final OBJECT IDENTIFIER points to the root of the tree that your program is going to manage. foo is the root of the subtree managed by foosmuxd. For simplicity's sake, foosmuxd manages the entire foo MIB. In real life, this wouldn't be the case because it precludes other peers from managing subtrees of the foo MIB.

Following this start, you have the actual definitions of the MIB objects, followed by


Compiling MIB modules

Once you have defined a MIB module, you can compile it. This step is not absolutely necessary, because the make command runs the mosy compiler automatically when make compiles the entire peer program (see ``Compiling an SMUX peer''). You can invoke make on the MIB module to verify that mosy will compile the module into a form that the peer program can read. The command to run mosy on is:

make -f foosmuxd.defs

Replace the string ``foo'' with the identifying string for your peer.

The syntax of the compiled module foosmuxd.defs is:

  1. Comments start with ``--'' or ``#'' at the beginning of a line.

  2. Object identifiers are defined thus:

    #name value
    internet iso.3.6.1

  3. Object types are defined thus:

    #name oid syntax access status
    productName serialBoard.1 DisplayString read-only mandatory

    where ``name'' and ``oid'' are obvious. For the rest:

    ``syntax'' is the name of a defined syntax;

    ``access'' is one of read-only, read-write,
    or none;

    ``status'' is one of mandatory, optional, deprecated, or obsolete.

    Names of objects are always case-sensitive.

Run the post_mosy program on the compiled output to produce an ASCII file containing the names and numeric object identifiers of each object in the compiled output.

post_mosy -i foosmuxd.defs

The resulting ASCII file looks something like this:

"ccitt"		"0"
"iso"	"1"
"internet"	""
"directory"	""
"mgmt"	""
"experimental"	""
"private"	""
"enterprises"	""
"foo"	""
"serialBoard"	""
"productName"	""
"boardStatus"	""
"exampleIpAddr"	""
"exampleObjectID"	""
"numberLines"	""
"serialLineTable"	""
"serialLineEntry"	""
"serialLineNumber"	""
"serialLineBaudRate"	""
"serialLineTermLocation"	""
"joint-iso-ccitt"	"2"
This output file is meant to be read as configuration data by network management utilities.

Next topic: #define statements
Previous topic: Implementing an SMUX peer

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003