Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

snmp-subtree.js 590B

12345678910111213141516171819202122232425
  1. // Copyright 2013 Stephen Vickers
  2. var snmp = require ("../");
  3. var options = require("./option-parser");
  4. var session = options.session;
  5. var oid = options.oids[0];
  6. var maxRepetitions = options.maxRepetitions || 20;
  7. function doneCb (error) {
  8. if (error)
  9. console.error (error.toString ());
  10. }
  11. function feedCb (varbinds) {
  12. for (var i = 0; i < varbinds.length; i++) {
  13. if (snmp.isVarbindError (varbinds[i]))
  14. console.error (snmp.varbindError (varbinds[i]));
  15. else
  16. console.log (varbinds[i].oid + "|" + varbinds[i].value);
  17. }
  18. }
  19. session.subtree (oid, maxRepetitions, feedCb, doneCb);