Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I need to send a trap using the snmptrap command.

  1. If I use SNMPv1 the trap is sent:
snmptrap -v 1 -c public localhost EXAMPLE-MIB::MyTestFFAlarmTrap  localhost 4 0 '' EXAMPLE-MIB::trapType i 1 
EXAMPLE-MIB::trapTimeStamp t 500 
EXAMPLE-MIB::trapID s "device-1" 
EXAMPLE-MIB::trapCode i 3 
EXAMPLE-MIB::trapDescription s "Power alarm"
  1. If I use SNMPv3 the trap is not sent. I know the configuration is correct because I am sending these same traps from an SNMP agent using SNMPv3 and it works.

I only have the problem when sending them with the snmptrap command.

  • Option 1:
snmptrap -v3 -e 0x0102030405 -u usr1 -a SHA -A "12345678" -x DES -X "12345678" localhost   1000 EXAMPLE-MIB::MyTestFFAlarmTrap  localhost 4 0 '' EXAMPLE-MIB::trapType i 1 
EXAMPLE-MIB::trapTimeStamp t 500 
EXAMPLE-MIB::trapID s "device-1" 
EXAMPLE-MIB::trapCode i 3 
EXAMPLE-MIB::trapDescription s "Power alarm"

The screen shows the error:

localhost: Unknown Object Identifier (Sub-id not found: (top) -> localhost)
  • Option 2:
snmptrap -v3 -e 0x0102030405 -u usr1 -a SHA -A "12345678" -x DES -X "12345678" localhost 4 0 '' EXAMPLE-MIB::MyTestFFAlarmTrap  localhost 4 0 '' EXAMPLE-MIB::trapType i 1 
EXAMPLE-MIB::trapTimeStamp t 500 
EXAMPLE-MIB::trapID s "device-1" 
EXAMPLE-MIB::trapCode i 3 
EXAMPLE-MIB::trapDescription s "Power alarm"

The screen shows the error:

: Unknown Object Identifier (Sub-id not found: (top) -> )
  • Option 3:
snmptrap -v3 -e 0x0102030405 -u usr1 -a SHA -A "12345678" -x DES -X "12345678" localhost '' EXAMPLE-MIB::MyTestFFAlarmTrap  localhost 4 0 '' EXAMPLE-MIB::trapType i 1 
EXAMPLE-MIB::trapTimeStamp t 500 
EXAMPLE-MIB::trapID s "device-1" 
EXAMPLE-MIB::trapCode i 3 
EXAMPLE-MIB::trapDescription s "Power alarm"

The screen shows the error:

localhost: Unknown Object Identifier (Sub-id not found: (top) -> localhost)
  • Option 4:
snmptrap -v3 -e 0x0102030405 -u usr1 -a SHA -A "12345678" -x DES -X "12345678" 127.0.0.1 '' EXAMPLE-MIB::MyTestFFAlarmTrap  localhost 4 0 '' EXAMPLE-MIB::trapType i 1 
EXAMPLE-MIB::trapTimeStamp t 500 
EXAMPLE-MIB::trapID s "device-1" 
EXAMPLE-MIB::trapCode i 3 
EXAMPLE-MIB::trapDescription s "Power alarm"

The screen shows the error:

localhost: Unknown Object Identifier (Sub-id not found: (top) -> localhost)

I have checked the syntax of the snmptrap command in a tutorial or forum that I have found on the internet and I do not see the reason for the error.

I appreciate any help.

question from:https://stackoverflow.com/questions/66061758/issue-sending-snmpv3-trap-with-the-command-snmptrap

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
464 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...