SNMP Manager Programmer's Guide

Programming Examples
SNMP Manager Programmer’s Guide134249
2-4
Overview of Source Code Structure
1. Log onto the NonStop Kernel system on which the sample files are installed:
logon snmp.user1
2. Edit the build script in grdbuild to reflect the location of the sample files on your
system. Edit snmpwlkc to qualify the file name of mibrt (in the read_mib() call) to
reflect the location of mibrt on your system.
3. Build the sample managers:
obey grdbuild
4. Ensure that any agents and subagents you want the managers to interact with are
running. The SNMP Configuration and Management Manual tells you how to start
the NonStop agent and subagents Tandem provides.
5. For any agents you will be communicating with, identify the following information:
Community strings supported
IP address at which the agent can be reached
Port the agent monitors for request packets
Process names of NonStop agents
6. Many of the managers require that you pass one or more OIDs at invocation (unless
the objects you want to operate on are MIB-II objects). Therefore familiarize
yourself with any MIBs containing objects of interest to you.
7. Start a manager. The subsections that describe each sample manager provide startup
instructions. For example, the following invocation starts SNMPHOST as a process
named $mymgr and requests that it retrieve MIB object values for five devices in the
Host Resources MIB by communicating with the NonStop agent monitoring port
161 on a node named SomeSys:
snmphost /name $mymgr/ -d 5 -c "MyCommunityName" -p 161
SomeSys
8. Most of the managers run for only a very short time. If you need to stop an
executing manager, however, you can use the TACL STOP command, identifying
the name of the manager process:
stop $mymgr
After familiarizing yourself with the behavior of the sample managers, try modifying
them to change how they work.
Overview of Source Code Structure
This subsection describes attributes that many of the sample managers have in common:
The sample managers that support UDP only (SNMPGT, SNMPTRAP, and
SNMPMON) perform all their activities using almost identically structured source
code contained in a single file.
The sample managers that support both UDP and IPC (SNMPGET, SNMPNEXT,
SNMPSET, SNMPWALK, and SNMPHOST) perform packet encoding and