Creating a Subagent Using the eSNMP API
3.2 The Structure of Management Information
Normally, it is the nonleaf nodes that are registered as a subtree with the master
agent. However, leaf nodes, or even specific instances, can be registered as a
subtree.
The master agent delivers requests to the subagent that has the MIB subtree
with the longest prefix and the highest priority.
3.3 Creating a MIB Source File
Creating the MIB source file requires the following four-step process:
1.
Write the ASN.1 input files, as described in Section 3.3.1.
2.
Process the input files with the MIB compiler, as described in Section 3.3.2.
3.
Compile and link the routines, as described in Section 3.4.
4.
Include the subagent, as described in Section 3.5.
3.3.1 Writing the ASN.1 Input File
After you have assigned names and OIDs to all of the objects in the MIB, create
an ASN.1 source file using ASCII statements.
Note
Providing information about ASN.1 syntax and programming is beyond
the scope of this guide. For more information about ASN.1 programming,
refer to one or more of the documents on this subject provided by the
International Organization for Standardization (ISO).
Instead of creating ASN.1 files yourself, you can create .MY files from existing
ASCII files (for example, from RFCs) by using the MIB-converter facility provided
with TCP/IP Services. This facility uses a UNIX
awk
script, which runs on
OpenVMS as well as on appropriately configured UNIX systems. For details
about the facility, see the MIB-CONVERTER.AWK file, which is located in
the [.SNMP] subdirectory of TCPIP$EXAMPLES. Standard .MY files are also
provided for your convenience.
The custom MIB definition files have the default extension .MY.
3.3.2 Processing the Input File with the MIB Compiler
Process your ASN.1 source files with the MIB compiler using the DCL command
MIBCOMP.
Note
If you are familiar with processing on UNIX systems, you can use the
UNIX utilities
snmpi
and
mosy
. See Section 3.3.2.1 for more information.
The compilation process produces two template C programming modules that
are used in building the executable subagent code. When you run the compiler,
specify all the ASN.1 source files for a given subagent. Whenever any of these
source files are updated, you must repeat the compilation process.
The syntax for the MIBCOMP command is as follows:
MIBCOMP MIB-source-file "subtree" [/PREFIX=prefix-name] [/PRINT_TREE] [/SNMPV2]
Creating a Subagent Using the eSNMP API 3–5