Generate traps using "sm_snmp" with multiple varbinds
search cancel

Generate traps using "sm_snmp" with multiple varbinds

book

Article ID: 327745

calendar_today

Updated On:

Products

VMware Smart Assurance VMware Telco Cloud Service Assurance

Issue/Introduction

To generate test traps using the "sm_snmp" command line tool to include multiple varbinds to test incoming trap definitions.

Environment

Smarts 10.1.x

TCSA 2.x

Resolution

To use sm_snmp to generate traps with multiple varbinds using the following example:

  • The test trap should have the following:
Timestamp:       22-Sep-2004 05:05:05 ED
Agent:           #.#.#.#
Enterprise OID:  .1.3.6.1.4.1.546.1.1
Generic Type:    6
Specific Type:   7
Varbinds:        [oid]->[varbind]
                 .1.3.6.1.4.1.546.5.6.4.1.2.<value> --> 1
                 .1.3.6.1.4.1.546.5.6.4.1.5.<value> --> 2
                 .1.3.6.1.4.1.546.5.6.4.1.3.<value> --> 1129450700
                 .1.3.6.1.4.1.546.5.6.4.1.7.<value> --> TestName
                 .1.3.6.1.4.1.546.5.6.4.1.9.<value> --> This is a test alarm
                 .1.3.6.1.4.1.546.5.6.4.1.12.<value> --> Event Log - Application Warning
                 .1.3.6.1.4.1.546.5.6.4.1.1.<value> --> <value>
                 .1.3.6.1.4.1.546.5.6.4.1.14.<value> --> 8 

The <value> above would be an index number that's included in the trap send from the device. 
For the example, we assume the value is 151001

  • You will use the command format below:
./sm_snmp -d <trap receiver> -p <SNMP port> trap <agent IP address> <enterprise oid> <generic type> <specific type> 0 <varbind 1> <type> <varbind1 value> 
  • It will work up to and including the first varbind (.1.3.6.1.4.1.546.5.6.4.1.2.151001 --> 1).  To "expand" this to include the other varbinds, you just add more (oid, type, value) triplets at the end of command line. In this case it would become:
./sm_snmp -d <trap receiver> -p <SNMP port> trap 111.222.333.444 .1.3.6.1.4.1.546.1.1 6 7 0 .1.3.6.1.4.1.546.5.6.4.1.2.151001 i 1 .1.3.6.1.4.1.546.5.6.4.1.5.151001 i 2 .1.3.6.1.4.1.546.5.6.4.1.3.151001 i 1129450700 .1.3.6.1.4.1.546.5.6.4.1.7.151001 s "TestName" .1.3.6.1.4.1.546.5.6.4.1.9.151001 s "This is a test alarm" .1.3.6.1.4.1.546.5.6.4.1.12.151001 s "Event Log - Application Warning" .1.3.6.1.4.1.546.5.6.4.1.1.151001 i 151001 .1.3.6.1.4.1.546.5.6.4.1.14.151001 i 8

Additional Information

When you expand the varbind like the above example, the "i" in

.1.3.6.1.4.1.546.5.6.4.1.2.151001 i 1

Indicates this value is an integer.  While the "s" indicates this value is a string

.1.3.6.1.4.1.546.5.6.4.1.7.151001 s "TestName"

The string value is enclosed by double quotation marks