SNMP Subagent Programmer's Guide

Programming Tutorials
SNMP Subagent Programmer’s Guide119728 2-33
Static Directory Program
Static Directory Program
This subagent illustrates how to make a tabular MIB object manageable. In this case the
table is static: that is, its entries do not change while the subagent is executing. Dealing
with static tables is simple for a subagent. All the subagent has to do is build the table
and register each of its rows using mgmt_new_instance(). Thereafter, the run-time
library can find entries whenever mgmt_poll() is called.
These files are related to Static Directory:
Functions
Invoke Static Directory by specifying the executable subagent name and a NonStop
agent process name:
RUN FIXEDLS /NAME $STAT/ $ZSNMP
Static Directory builds a table whose entries are the files that reside in the subvolume
named zsnmpsdk at the time it is invoked. Once the table is built, the subagent handles
requests from SNMP managers to read the table entries.
MIB
Example 2-5 shows the MIB definition used by Static Directory. The MIB defines the
following objects:
fixedlsc C source code
dirC C source code
dirH C source code
fxdlssmi MIB definition
fixedlsm TACL routine
dirName The subvolume name. The MIB extension encoded in the ACCESS clause
indicates that the MIB value is maintained in a field named dir_name of a
structure named “directory.
dirFiles The table.
fileEntry A table entry. Each entry consists of a single object: fileName. The index
to a table entry consists of the value of its fileName.
fileNam
e
The name of a file in the subvolume. The MIB extension indicates that the
MIB value is maintained in a field named file_name of a structure named
file_entry. The value of this object serves as the index to each entry.