0neblock / Arduino_SNMP

SNMP Agent built with Arduino
MIT License
77 stars 30 forks source link

addOIDHandler #3

Closed AdamPiorko closed 6 years ago

AdamPiorko commented 6 years ago

Will there be an addOIDHandler function added? I need to return information on question 1.3.6.1.2.1.1.2.0 which requires the OID data type.

For example: snmpget -v 1 -c public 1.3.6.1.2.1.1.2.0 iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.14988.1

0neblock commented 6 years ago

Hey,

I made a quick addition that enables this in commit #4b7f89ef snmp.addOIDHandler(".1.3.6.1.2.1.1.2.0", ".1.3.6.1.4.1.14988.1");

Let me know if it works.

AdamPiorko commented 6 years ago

Something is wrong. snmp.addOIDHandler(".1.3.6.1.2.1.1.2.0", ".1.3.6.1.4.1.14988.1"); responds snmpget -v 1 -c public 192.168.2.186 1.3.6.1.2.1.1.2.0 iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.14988.1

snmp.addOIDHandler(".1.3.6.1.2.1.1.2.0", ".1.3.6.1.4.1.52421.1"); responds snmpget -v 1 -c public 192.168.2.186 1.3.6.1.2.1.1.2.0 iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.3269.1

0neblock commented 6 years ago

Hey, I noticed this too, it was a problem with the way I was encoding the ASN.1 packets. Fixed in commit: #229a7fccf

AdamPiorko commented 6 years ago

It works. Thank you.