From 3a91c15558fc41a17e3300d4364bccc1f42f0b11 Mon Sep 17 00:00:00 2001 From: Dmitrey Salnikov Date: Thu, 21 Jul 2016 18:15:34 +0300 Subject: [PATCH 1/2] Update client.js support for specify trap port number --- lib/client.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index 52be399..5d63d33 100644 --- a/lib/client.js +++ b/lib/client.js @@ -176,7 +176,15 @@ Client.prototype.getBulk = function (ip, community, non_repeaters, repeaters, Client.prototype.SNMPv2_Trap = Client.prototype.inform = function (ip, community, uptime, oid, varbinds, cb) { var self = this; - send(this, ip, 162, message.createMessage({ + + var port = 162; + var addr = ip.split(":"); + if (p.length == 2){ + ip = addr[0]; + port = parseInt(addr[1]); + } + + send(this, ip, port, message.createMessage({ version: 1, community: community, pdu: PDU.createPDU({ From 7cf74e1cb92de678e80ee5e6ea6efba53c703487 Mon Sep 17 00:00:00 2001 From: Dmitrey Salnikov Date: Thu, 21 Jul 2016 18:17:57 +0300 Subject: [PATCH 2/2] Update client.js var name miss --- lib/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index 5d63d33..1df973c 100644 --- a/lib/client.js +++ b/lib/client.js @@ -179,7 +179,7 @@ Client.prototype.inform = function (ip, community, uptime, oid, varbinds, cb) { var port = 162; var addr = ip.split(":"); - if (p.length == 2){ + if (addr.length == 2) { ip = addr[0]; port = parseInt(addr[1]); }