Skip to content

Instantly share code, notes, and snippets.

@shanept
Created October 14, 2016 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanept/76ff4d40fd5a3421e22f611c8feae342 to your computer and use it in GitHub Desktop.
Save shanept/76ff4d40fd5a3421e22f611c8feae342 to your computer and use it in GitHub Desktop.
setTimeout(function() {}, 1000);
var snmp = require ("./git/node-net-snmp/lib/");
var target = '127.0.0.1';
var version = snmp.Version3;
var oids = ['1.3.6.1.2.1.1.1.0'];
var session = snmp.createSession (target, {
version: version,
// timeout: 10000,
engineID: 'shane-ubuntu-node',
boots: 0,
securityModel: snmp.SecurityModel.USM,
securityName: 'testUser'
});
session.get (oids, function (error, varbinds) {
if (error) {
console.error (error.stack);
} else {
for (var i = 0; i < varbinds.length; i++) {
if (snmp.isVarbindError (varbinds[i]))
console.error (snmp.varbindError (varbinds[i]));
else
console.log (varbinds[i].oid + "|" + varbinds[i].value);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment