We are using the SNMP node. It is working ok.
We are sending SNMP get to multiple ports on a device so need to send multiple oid's
We verified that we can provide a list of oid ( separated by commas) in the SNMP OID Properties .
However when we try to pass a msg.oid (created from a function), we are not able to get it to work.
The msg.oid format we are sending loolks like this:
Each oid is seperated with a comma. It must be some formatting issue. Any advise would be appreciated.
Hi Colin
msg.oid we pass in includes the " ...." and the trailing , ( comma)
so we verified that that is the problem as we 'copy and pasted' without the " ...." and the trailing , ( comma) to the SNMP properties OID .
The question is then: how do we change the function msg.oid so when it passes in the msg.oid , that the " ...." and the trailing , ( comma) are removed
Since you have not posted the function it is impossible to say. Copy/paste the function text here. When pasting use the </> button at the top of the forum entry window.
[Edit] Also show us what you see in a debug node showing what it going into the function and another showing what is coming out.
The quotes are not actually present in the string. They are added when you display it in order to identify it as a string. To remove the trailing comma, switch it round so it appears at the start and miss it off the first time. Also it is often easier to use + rather than concat. So something like
let oid = ""
let terminator = ""
for(let i = 1; i<= 52; i++){
oid += `${terminator}1.0.8802.1.1.2.1.5.32962.1.2.1.1.1.${i}`
terminator = ","
}
msg.oid = oid
return msg
The reason it is easier to code a solution that misses it off the first time rather than the last time is that it easy to do something different the first time, it is much more difficult to do something different the last time.
Hi Colin,
Thank you for the explanation and suggestions. It makes sense and i learned something.
The SNMP node is nice. FYI, we had used the EXEC node to do the SNMP get ( not sure why we got on that crazy train)- the SNMP node is much easier to deal with.