Node-Red configuration
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

snmp-trap.js 532B

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. });