I need to send a trap using the snmptrap command.
- 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"
- 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.
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)
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) -> )
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)
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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…