SNMP Manager Programmer's Guide
Programming Examples
SNMP Manager Programmer’s Guide–134249
2-107
SNMPMON
SNMPMON
SNMPMON monitors a UDP port for SNMP packets and prints any packets it receives.
When you invoke this manager, you can optionally specify a port number and TCP/IP
process name:
port-to-monitor
identifies the UDP port to use for packet receipt. To use a port numbered less than
1024, the SNMPMON process must be started by a member of the super user group
(255, n). The default value is 162.
tcp/ip-process-name
identifies the TCP/IP process to bind to for packet receipt. The default is $ZTC0.
Example 2-14
illustrates the output SNMPMON generates when it intercepts a coldStart
trap sent by SNMPTRAP. SNMPTRAP was started with the following invocation line
before starting SNMPMON; 130.252.68.36 is the IP address that TCP/IP process $ZTC1
uses:
SNMPTRAP -p 3000 130.252.68.26
Example 2-15 illustrates the contents of snmpmonc, the source code file for
SNMPMON. The numbers in the example correspond to numbers in the observations
made between here and the example.
1. The default port and TCP/IP process assignments are made.
2. The socket_set_inet_name() function identifies the name of the TCP/IP process for
the socket library to open.
3. A UDP socket is obtained.
4. The socket is associated with the IP address just initialized.
5. This while loop receives packets, decodes them, and prints them until an error
occurs.
SNMPMON [-p port-to-monitor]
[-t tcp/ip-process-name]
Example 2-14. Example SNMPMON Output
TACL> SNMPMON -t $ZTC1 -p 3000
-----------------------
RECEIVED PACKET 1:
Packet Length=40, Version=0, Community: Length=6, Value=public
PDU Type=trap Length=27, Enterprise id:
OBJECT IDENTIFIER: nonstopsystems
IpAddress: 130.252.12.3
Generic trap-coldStart, specific trap=0 (0), Trap time=0 (0)
VBLlen=0, VBcount=0