I'm working on application that receive snmp trap and create a json object of this trap according to mib file in NodeJS. I've received the trap and print it using util.inspect according to this tutorial here: http://atlantageek.com/2014/08/23/snmp-trap-listener-in-node3/
and this is the code snippet:
trapd.on('trap', function(msg){
result.push(msg);
var now = new Date();
console.log("Trap Received " + now);
console.log(util.inspect(snmp.message.serializer(msg)['pdu'], false, null));
console.log(result.length);
});
How to translate OIDs of snmp trap into textual object identifiers using the MIB description files, is there any snmpjs built-in function or any other library such as [pysnmp in python] can I use it?!
Thanks in advance
Finally I' found this library, It's not optimal but it works fine after some editions.
https://github.com/PrimeEuler/mib.js