Tuesday, 4 April 2017

Why snmpjs node module is not exposing in manager information to agent?

Why snmpjs node module is not exposing in manager information to agent?

I am using snmpjs node module to send trap message to manager according to my usecase,

where manager will request network element from a agent installed in the network. once agent receive the request from manager it will start sending network element data to manager through the trap message on a regular interval.

I am implementing this scenario as following

Agent will receive the request like

agent.request({ oid: '.1.3.6.1.2.1.1.5', handler: function (prq) {

});

To send trap message

var trapAgent = dgram.createSocket('udp4');

var trap = snmp.message.createMessage({
    version: 0, //this means send a SNMP v1 trap
    community: "public",
    pdu: snmp.pdu.createPDU({
            op: 4,//SNMP trap v1
            //...etc. etc.
    }),
});

var str = JSON.stringify(trap);
var buf = new Buffer(str.toString());

trapAgent.send(buf, 0, buf.length, 162, ip, function(err, bytes) {
    if(err) console.log(err);
    console.log(i+") -  "+bytes+" bytes written");
});

while sending trap message it requires manager ip address, I did not find any way to get manager IP adrress in agent.request callback function.

Later i found out that inside snmpjs it is not exposing the manager information to agent,

I have some questions

  1. So is there any other way to get manager information in agent?
  2. why snmpjs node module is hiding the manager information, is there any security reason for this?
  3. Is there any other nodejs module to solve my problem?


via Basavaraj Burge

No comments:

Post a Comment