Hi, i did the probe but the result is the same with the first function
the same happens in the text file
and with second function there is an error
I want tell you that in one machine I could go to the old snmp node version 0.0.25 and inmediatly start work ok, really the problem is clear.
I appreciate your time and effort and I'm really grateful, is not nescessary that you lose your time in this problem. If you want to do some more probes I can put your functions in the flow an probe it, if not, is all right.
Unfortunately I can't do changes over your functions because I don't have the knowledge.
Thank you
I would really like to get to the bottom of why my function doesn't work. It certainly can be made to word, it is just a matter of better understanding the data format, then you won't have to worry about being stuck with an old version which may fail to work at some point. Can you try this please.
I have probed a lot of functions that simulated works ok, the problem is when I use SNMP NODE + FUNCTION (string conversion) + Write to file node
Iām not a programmer, Iām only an user, I understand somethings but I donāt have the knowledge for introduce changes like this. Really I donāt know what is happening.
But I found a solution using an old SNMP NODE version, from v2.0.0 to v0.0.25 and problem was solved.
You can see the code that was commented out when I "fixed" it for version 2
The reason for the change was that the underlying snmp returns a unique snmp object type - that other users were expecting - and by my changing just the octet string type it broke the object they were expecting, so it was decided to just return the native object as returned from the library so the user could process it later as required.
HI, I understand the advantages of solve it using the newest version
this are the results and the flow, function1 have your code, like you can see, in text file value appear in raw mode
Thank you, I understand that version 2.0.0 of snmp node contains changes that requires a modification in the way that value must be showed. But in the code that you have posted, you show a solution or the source of he problem?
I followed the link in giihub, I can download the code,, is this a version of snmp node? can I install it?
sorry by my ignorance.
@dceejay or anyone else, looking at my function and contents of the incoming payload can anyone understand how typeof msg.payload[0].value.data is undefined?
as I said the snmp lib returns a weird non-standard object so yeah I don't know as I haven't dug into it (not using snmp for anything right now) - but is probably related to that.
why turn it back into a Buffer ? It's a string at the end of the day.
And if it's the .value that is the issue then maybe set msg.payload[0].foo instead - ie a new different property
snmp data type 4 is an OctetString (also shown as the tstr property). so just bytes as a string. So in theory it's safe to turn into a string... BUT when I did that it caused other (real power) snmp users to have problems and so I "fixed" it to send what they expect and let them handle it.
Can I clarify something? On the system with the problem do all messages have this format, or do some have the old. The purpose of the if clause in the code is to determine which of those it is, so is not necessary if it does not need to handle both types of messages. Also now it is working you can remove the node.warn() lines which were for diagnostic output to help work out what is going on.
Also, in order to get to the simplest solution, could you try, as suggested by @dceejay just this in the function