Arduino_SNMP
Arduino_SNMP copied to clipboard
SNMP trap
Hi
I am a novice when it comes to SNMP so maybe this is just an self induced coding problem. I have followed the example code to send a SNMP trap. I have been using my Linux machine to receive the SNMP trap send from my Arduino system.
On my Linux system I run sudo snmptrapd -f -Le -d
output will then be:
Received 76 byte packet from UDP: [192.168.2.102]:161->[192.168.2.5]:162
0000: 30 4A 02 04 00 00 00 01 04 06 70 75 62 6C 69 63 0J........public
0016: A6 3A 02 04 FB BD FF 46 02 04 00 00 00 00 02 04 .:.....F........
0032: 00 00 00 00 30 26 30 10 06 08 2B 06 01 02 01 01 ....0&0...+.....
0048: 03 00 43 04 00 00 02 A4 30 12 06 08 2B 06 01 02 ..C.....0...+...
0064: 01 01 02 00 06 06 2B CE 04 03 01 01 ......+.....
Cannot find TrapOID in TRAP2 PDU If I change line 151 in SNMPTrap.h OIDType* snmpTrapOID = new OIDType(".1.3.6.1.2.1.1.2.0"); to OIDType* snmpTrapOID = new OIDType(".1.3.6.1.6.3.1.1.4.1.0");
The output from snmptrapd will than be: Received 78 byte packet from UDP: [192.168.2.102]:161->[192.168.2.5]:162 0000: 30 4C 02 04 00 00 00 01 04 06 70 75 62 6C 69 63 0L........public 0016: A6 3C 02 04 33 71 7B 04 02 04 00 00 00 00 02 04 .<..3q{......... 0032: 00 00 00 00 30 28 30 10 06 08 2B 06 01 02 01 01 ....0(0...+..... 0048: 03 00 43 04 00 00 06 2E 30 14 06 0A 2B 06 01 06 ..C.....0...+... 0064: 03 01 01 04 01 00 06 06 2B CE 04 03 01 01 ........+.....
2022-04-13 11:37:36 <UNKNOWN> [UDP: [192.168.2.102]:161->[192.168.2.5]:162]: DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1582) 0:00:15.82 SNMPv2-MIB::snmpTrapOID.0 = OID: EISCAT-MIB::eiscat.3.1.1
So I am not really sure what the problem can be but for the moment I will use: OIDType* snmpTrapOID = new OIDType(".1.3.6.1.6.3.1.1.4.1.0");
I am very happy to have found this library as it has served me very well. All the best Assar W.
Thanks for this, nice find. Maybe if you'd like to make a PR for this change in the example SNMPTrap.h
file?