Closed kanavis closed 9 years ago
The received data is not a valid SNMP packet, so there is an error. You can listen for the error event to catch this.
Then should I override the console object to supress the unneccessary output?
Session.prototype.parseError = function (error, buffer) {
var self = this, hex;
// Display a friendly introductory text.
console.error('Woops! An error occurred while parsing an SNMP message. :(');
console.error('To have this problem corrected, please report the information below verbatim');
console.error('via email to snmp@nym.se or by creating a GitHub issue at');
console.error('https://github.com/calmh/node-snmp-native/issues');
console.error('');
console.error('Thanks!');
// Display the stack backtrace so we know where the exception happened.
console.error('');
console.error(error.stack);
........
self.emit('error', error);
Yeah, that's not great...
Sometimes I get assertion errors when fetching sysdescr.0 from 4000+ switches with 30 concurrent fetches (limited by queue).
AssertionError: 48 == 60 at parse (/usr/home/kanavis/nms/tools/node_modules/snmp-native/lib/snmp.js:207:12) at EventEmitter.msgReceived (/usr/home/kanavis/nms/tools/node_modules/snmp-native/lib/snmp.js:387:15) at Socket.emit (events.js:110:17) at UDP.onMessage (dgram.js:472:8)
Message data: 3c 31 33 34 3e 4d 61 72 20 32 31 20 31 38 3a 32 34 3a 34 34 20 46 6f 72 77 61 72 64 65 64 20 66 72 6f 6d 20 64 65 73 33 35 32 36 2d 73 68 75 68 31 36 6b 35 2d 32 2e 73 77 2e 72 69 6e 65 74 2e 72 75 3a 20 31 39 32 2e 31 36 38 2e 32 33 31 2e 35 37 20 49 4e 46 4f 3a 20 50 6f 72 74 20 38 20 6c 69 6e 6b 20 64 6f 77 6e
events.js:85 throw er; // Unhandled 'error' event ^ AssertionError: 48 == 60 at parse (/usr/home/kanavis/nms/tools/node_modules/snmp-native/lib/snmp.js:207:12) at EventEmitter.msgReceived (/usr/home/kanavis/nms/tools/node_modules/snmp-native/lib/snmp.js:387:15) at Socket.emit (events.js:110:17) at UDP.onMessage (dgram.js:472:8)