SNMP Subagent Programmer's Guide

Hello World Program
2-4 119728SNMP Subagent Programmer’s Guide
Programming Tutorials
These files are related to Hello World:
Functions
Invoke Hello World by specifying the executable subagent name and the NonStop agent
process name:
RUN HELLO /NAME $HELLO/ $ZSNMP
The Hello World subagent is idle until it receives a request from an SNMP manager.
When it receives any request, it displays a message, initially Hello World. The
subagent supports the following manager requests:
Get and Set operations on the message displayed. Initially Hello World, the
message is represented by a MIB object named helloOutputText. The manager can
change the message with a Set request.
Get and Set operations on a MIB object named helloPrintFreq. When a manager
changes the value of helloPrintFreq, the subagent sends a trap to the manager. The
trap, defined by a MIB object named helloFreqChange, contains the new value of
helloPrintFreq.
Although the manager can change the value of helloPrintFreq with a Set request,
this action has no effect on the frequency with which the value of helloOutputText is
printed. The next sample subagent, Nowaited Hello World, fixes this defect.
Get operations on a MIB object named helloPrintCnt. This object is a count of the
number of times the subagent has displayed any message.
MIB
The first step in making a program manageable by an SNMP manager is to identify MIB
objects: the information to be accessed by a manager and any trap messages to send to
the manager. Each object is encoded in a MIB definition, using an extended version of
the standard concise MIB conventions. Refer to Section 3, “Writing and Compiling
MIBs,” for complete information on MIB definition.
The MIB definition shown in Example 2-1 describes the information and the trap that
Hello World makes visible to SNMP managers:
helloc C source code
hellosmi MIB
definition
hellom TACL routine
helloOutputText The message displayed