Developer's notes on using trapgen:
Usage: trapgen -d
Additional information is availble using "trapgen -h"
example: trapgen -d 192.168.2.3
Note: Either the -d pair or the -f pair (which must contain a -d pair) is mandandatory
The above example will generate a trap that looks like this:
community: public
sender ip: current host ip
Sender OID: 1.3.6.1.4.1.2854
Trap Type: 6 (enterprise specific)
Specific Type: 1
Timestamp: current time value from system (from time(0))
with an empty varbind list and send it to ip address 192.168.2.3 on port 162.
The above values are the defaults (except the destination ip address 192.168.2.3).
Use the following command line options to override these defaults or
use "trapgen -h" for help:
Other command line parameters:
-d destinationIpAddress:port e.g., -d 123.45.67.89:1025
-c communityName e.g., -c private
-o senderOID e.g., -o 1.3.6.1.4.1.2854
-i senderIP e.g., -i 199.8.7.6
-g trapType e.g., -g 5
-s specificType e.g., -s 23
-t timestamp e.g., -t 234445
-r requestId e.g., -r 42
-m timeout e.g., -m 10
-p a - dumps the trap in ascii format to the screen, does not send
-p h - dumps the trap in hex format to the screen, does not send
-p b - dumps the trap to the screen in both hex and ascii format (does not send)
In addition, you can specify varbinds to be added with the -v switch:
-v oid TYPE value
where:
oid is the object id of the variable
TYPE is one of the following:
STRING
COUNTER
GAUGE
INTEGER
ADDRESS
OID
TIMETICK
HEX
and
value is the value to associate in the varbind
For example:
-v 1.3.6.1.4.1.1824.1.0.0.1 STRING "Very High Temperature"
Note the use of quotes ("") to enclose the text which contains spaces.
Using the -f filename option:
You may store the parameter information in a text file. The text file should look like a series of command line options, with each option on a separate line.
For example:
-d 123.45.67.89:1025
-c private
-o 1.3.6.1.4.1.1824
-i 199.8.7.6
-g 5
-s 23
-t 12445
-v 1.3.6.1.4.1.1824.1.0.0.1 STRING This is a string (you do not need quotes)
-v 1.3.6.1.4.1.1824.1.0.0.1 COUNTER 3345556
-v 1.3.6.1.4.1.1824.1.0.0.1 GAUGE 12343212
-v 1.3.6.1.4.1.1824.1.0.0.1 INTEGER 99
-v 1.3.6.1.4.1.1824.1.0.0.1 ADDRESS 100.200.123.111
-v 1.3.6.1.4.1.1824.1.0.0.1 OID 1.2.3.4.5.6.7.8.9
-v 1.3.6.1.4.1.1824.1.0.0.1 TIMETICK 2233121
In addition to the options listed in the file, the command line options will also be processed.
The command line options will override the file specified options (except varbind info which will accumulate).
Please note:
Send an email to trapgen@ncomtech.com if you wish to be notified when new features are available.
Happy Trapping!
Network Computing Technologies, Inc.