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.

1234567891011121314151617181920212223
  1. // Copyright 2013 Stephen Vickers
  2. var dns = require ("dns");
  3. var os = require ("os");
  4. var snmp = require ("../");
  5. var options = require("./option-parser");
  6. var session = options.session;
  7. var typeOrOid = options.oids[0];
  8. dns.lookup (os.hostname (), function (error, address) {
  9. if (error) {
  10. console.trace (error);
  11. } else {
  12. // address will be ignored for version 2c
  13. session.trap (snmp.TrapType[typeOrOid] || typeOrOid,
  14. address, function (error) {
  15. if (error)
  16. console.trace ("Trap failed: " + error);
  17. });
  18. }
  19. });