SNMP Subagent Programmer's Guide
Programming Tutorials
SNMP Subagent Programmer’s Guide—119728 2-27
Fault-Tolerant Hello World Program
Fault-Tolerant Hello World behaves like Nowaited Hello World once connection with a
particular NonStop agent has been established:
•
It prints the value of helloOutputText at the frequency associated with
helloPrintFreq.
•
It also prints the value of helloOutputText when it receives any request.
•
It supports Get and Set operations on helloOutputText.
•
It supports Get and Set operations on helloPrintFreq.
•
It supports Get operations on helloPrintCnt.
•
It generates a trap when the value of helloPrintFreq changes.
MIB
This program uses the same MIB as Hello World. The MIB is shown in Example 2-1,
earlier in this section.
Logic
Fault-Tolerant Hello World builds an array of a structure that uniquely identifies each
NonStop agent connection. The mgmt_read_nowait() function and the AWAITIOX
procedure are used to detect requests that arrive from any of the agents.
Logic Flow
Figure 2-3 summarizes how Fault-Tolerant Hello World uses management functions and
Guardian procedure calls:
1. The mgmt_init_env(), mgmt_new_instance(), and mgmt_read_nowait() functions
are called for each NonStop agent specified at invocation. Then, the subagent cycles
through the following calls until no agent connections remain.
2. The AWA IT I O X procedure determines whether any external message or file is
ready to process.
3. The FILE_GETINFO_ procedure obtains information about any incomplete I/O
operations. If a timeout has occurred, the current value of helloOutputText is
printed.
4. If a message arrives from any of the specified agents, mgmt_poll() processes it.
5. When the message requests a Set operation on helloPrintFreq, mgmt_trap()
generates a trap.
6. The mgmt_read_nowait() function re-posts a read for any NonStop agent from
which a message was received.