I am implementing the pysnmp code for snmpv3, trying to send a trap over to a machine in my network. I can see that the trap is being seen in Wireshark but it does not show up in any of my trap receivers. The code is as below :
from pysnmp.hlapi import *
errorIndication, errorStatus, errorIndex, varBinds = next(
sendNotification(
SnmpEngine(OctetString(hexValue='8000000001020304')),
UsmUserData('usr', authKey='authh', privKey='privv',
authProtocol=usmHMACSHAAuthProtocol,
privProtocol=usmAesCfb128Protocol),
UdpTransportTarget('192.168.1.79',162),
ContextData(),
'trap',
NotificationType(ObjectIdentity('SNMPv2-MIB', 'authenticationFailure'))
)
)
if errorIndication:
print(errorIndication)
If I remove authKey, privKey, authProtocol and privProtocol, I can see the traps being recieved in the trap receiver but when I put them all in, I do not see the traps.
My questions are:
- Does ubuntu have to open up its 161 and 162 ports for windows machine to receive it?
- Even with a hard coded Engine ID, I am able to send a trap with no authentication, but is it necessary to have the correct Engine ID in the case of full authentication ? Is that why the trap isn't showing up? If so, can someone guide me on finding the engine ID of the receiving system ?
- Can we surely say that since Wireshark is clearly seeing the trap come through, its only a matter of configuration on Trap receiver to show the trap ?
Please help me with this.
Thank you.