Hello. I have been using net-snmp inside a function node to get some snmpv3 information.
I thanks to some help earlier I was able to get it to send the message with the information I need.
I am wanting to use a switch node though to send the information like temp, voltage, ect to different nodes but I am unable to get it to work. I have 0 js knowledge so i am finding it hard. Hoping somebody can point me in the right direction.
Here is what I have so far.
var user = {
name: "********",
level: snmp.SecurityLevel.authPriv,
authProtocol: snmp.AuthProtocols.md5,
authKey: "**********",
privProtocol: snmp.PrivProtocols.aes,
privKey: "********"
};
var session = snmp.createV3Session ("***.***.***.***", user);
var oids = ["*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*"];
session.get (oids, function (error, varbinds) {
if (error) {
console.error (error);
} else {
for (var i = 0; i < varbinds.length; i++) {
if (snmp.isVarbindError (varbinds[i])) {
console.error (snmp.varbindError (varbinds[i]));
} else {
msg.payload.temp = varbinds[0].value;
msg.payload.current= varbinds[1].value
msg.payload.voltage = varbinds[2].value
node.send(msg)
}
}
}
session.close ();
});
Thanks.