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-tail.js 487B

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. function poll () {
  7. session.get ([oid], function (error, varbinds) {
  8. if (error) {
  9. console.error (error.toString ());
  10. } else {
  11. if (snmp.isVarbindError (varbinds[0]))
  12. console.error (snmp.varbindError (varbinds[0]));
  13. else
  14. console.log (varbinds[0].value);
  15. }
  16. });
  17. }
  18. poll ();
  19. setInterval (poll, 1000);