Created
October 14, 2016 11:31
-
-
Save shanept/76ff4d40fd5a3421e22f611c8feae342 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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