Compaq AAR04BCTE Using the Trap Sender and Trap Receiver Programs, h host, p port, v version

Models: AAR04BCTE

1 132
Download 132 pages 53.41 Kb
Page 55
Image 55

 

Using the SNMP Utilities

 

4.2 Using the Trap Sender and Trap Receiver Programs

Table 4–5 (Cont.)

Flags for the snmp_trapsnd Command

 

 

 

Flag

Description

 

 

 

-hhost

Specifies the host name or IP address (in ASN.1 dot notation format) of the

 

destination host to receive the trap message. The default is localhost

 

(127.0.0.1).

 

-pport

Specifies a port number on the destination host where the message is to be sent.

 

The default is UDP 162.

-tcp

Specifies that the TCP transport be used instead of the default UDP transport.

 

If a connection cannot be established, the program displays the warning

 

connect - : connection refused.

-vversion

Specifies the SNMP version to use for sending the PDU. The valid versions are 2c

 

or 1 (default). You can specify the flag and value without including a space (for

 

example, -v2cand -v1).

 

 

 

4.2.1.3 Trap Sender Examples

In the following snmp_trapsnd command examples:

The first line is the snmp_trapsnd command.

The remainder is the display received when running the trap receiver program (snmp_traprcv) without flags included.

1.The following example generates a trap that originated on the localhost (specified by the agent parameter) using the default SNMP version (SNMP Version 1). The -hhost parameter is not specified, so the trap will be sent to the local host.

$ snmp_trapsnd 0.0 local 0 0 0

 

Message received from 127.0.0.1

 

SNMPv1-Trap-PDU:

 

community - 7075626C 6963

public

enterprise - 0.0

 

agent address - 0.0.0.0

 

trap type - Cold Start (0)

 

timeticks - 51938978

 

2.The following example generates the same trap as in example 1, except that it specifies the use of SNMP Version 2.

$ snmp_trapsnd 0.0 local 0 0 0 "-v2c"

Message received from 127.0.0.1

SNMPv2-Trap-PDU:

community - 7075626C 6963

public

sysUpTime.0 - 51938968 = 6 d 0:16:29 snmpTrapOID.0 - 0.0

3.The following example sends values to the node mynode with the community name special.

$ snmp_trapsnd 1.2.3 marley.dec.com 6 33 100 -c special -h mynode Message received from 16.20.208.68

SNMPv1-Trap-PDU:

 

community - 73706563 69616c

special

Using the SNMP Utilities 4–11

Page 55
Image 55
Compaq AAR04BCTE Using the Trap Sender and Trap Receiver Programs, h host, Using the SNMP Utilities, p port, v version