Wednesday, June 27, 2012

snmptrap

http://tiebing.blogspot.com/2007/05/snmptrap-command.html




snmptrap -v 1 -c public 192.168.100.40 1.2.3.4 192.168.254.60 3 0 ''

syntax:

-v 1: version 1
-c public: use community string "public"
192.168.100.40: trap manager's IP address (trap destination)
1.2.3.4: enterprise (i.e. type of device/object generating trap, default to system ID in mib II, can be empty)
192.168.254.50: trap source IP address (device's IP address)
3: generic trap ID, they are:
  • coldStart(0),
  • warmStart(1),
  • linkDown(2),
  • linkUp(3),
  • authenticationFailure(4),
  • egpNeighborLoss(5),
  • enterpriseSpecific(6)

0: specific trap ID, 0 when generic trap ID is not 6
'': system up time (timestamp)

You can also add "mib type value" to the end of the command to send them along with the trap

v2 trap:
snmptrap -v 2c -c public 192.168.100.40 "" 1.2.3.4.0

"": system Uptime (when given as empty "", the system finds itself)
1.2.3.4.0: trap OID

again, add "mib type value" to the end if you want.



v3 trap:

snmptrap -v 3 -a SHA -A 1234567890 -x DES -X 1234567890 -l authPriv -u myuser -e "123abc" 192.168.100.1 "" linkUp.0