|
|
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 topic 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.
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 topic, 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 foosmuxd.my. MIB modules fall into 3 broad categories:
SendMail-MIB { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) unix (4) sendmail (99) }DEFINITIONS ::= BEGIN
IMPORTS unix --*, OBJECT-TYPE *-- FROM RFC1155-SMI;
sendMail OBJECT IDENTIFIER ::= { unix 99 }
FOO-MIB DEFINITIONS ::= BEGINIMPORTS experimental, OBJECT-TYPE FROM RFC1155-SMI;
foo OBJECT IDENTIFIER ::= { experimental 99 }
FOO-MIB DEFINITIONS ::= BEGINIMPORTS enterprises, OBJECT-TYPE FROM RFC1155-SMI;
foo OBJECT IDENTIFIER ::= { enterprises 9999 }
Following this start, you have the actual definitions of the MIB objects, followed by
END
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
foosmuxd.my is:
make -f foosmuxd.mk foosmuxd.defs
Replace the string ``foo'' with the identifying string for your peer.
The syntax of the compiled module foosmuxd.defs is:
#
#
#name value
#
internet iso.3.6.1
#
#
#name oid syntax access status
#
productName serialBoard.1 DisplayString read-only mandatory
where ``name'' and ``oid'' are obvious. For the rest:
Names of objects are always case-sensitive.
The resulting ASCII file looks something like this:
"ccitt" "0" "iso" "1" "internet" "1.3.6.1" "directory" "1.3.6.1.1" "mgmt" "1.3.6.1.2" "experimental" "1.3.6.1.3" "private" "1.3.6.1.4" "enterprises" "1.3.6.1.4.1" "foo" "1.3.6.1.4.1.9999" "serialBoard" "1.3.6.1.4.1.9999.1" "productName" "1.3.6.1.4.1.9999.1.1" "boardStatus" "1.3.6.1.4.1.9999.1.2" "exampleIpAddr" "1.3.6.1.4.1.9999.1.3" "exampleObjectID" "1.3.6.1.4.1.9999.1.4" "numberLines" "1.3.6.1.4.1.9999.1.5" "serialLineTable" "1.3.6.1.4.1.9999.1.6" "serialLineEntry" "1.3.6.1.4.1.9999.1.6.1" "serialLineNumber" "1.3.6.1.4.1.9999.1.6.1.1" "serialLineBaudRate" "1.3.6.1.4.1.9999.1.6.1.2" "serialLineTermLocation" "1.3.6.1.4.1.9999.1.6.1.3" "joint-iso-ccitt" "2"This output file is meant to be read as configuration data by network management utilities.
Instead of running mosy and post_mosy separately on the command line, run the /usr/sbin/mibcomp.sh script. This runs the two utilities on one or more specified object modules, adding a number of object definitions to the ASCII file. For details, see the mibcomp(1Msnmp) manual page.