Is it possible to use the SNAP-PAC-R2 to send a SNMP SetRequest packet to an external SNMP device? It seems like it would be similar to sending a cold start trap but with different data. If that’s not possible, is it possible to send a specific bit/hex string using UDP? I used wireshark and GetIf to sniff the exact bit sequence that has to be sent. Unfortunately, the stream contains 0x00, which is equivalent to an ascii NULL, so typing the ascii string equivalent is not possible.
Could you give us a bigger-picture view of what you’re trying to do here? Usually SNMP is not the easiest way to do it, perhaps there’s another way. FYI, be sure to check out this SNMP 101 post[/U][/B], and perhaps also [B][U][URL=“http://www.opto22.com/community/showthread.php?t=170”]this SNMP discussion which includes some sample OptoScript code/charts. Note that the second discussion I mentioned there includes 2 pages and the 1st reply on the last page is from someone claiming to have done something similar to what you’re trying to do there. You might post a reply to that thread and ask for details.
However, since you mentioned Wireshark and rolling your own UDP packet (fun stuff!), I’d also like to address your comment about typing an ASCII 0x00. You can still build a string in PAC Control with whatever binary values you want in it (I do it all the time, often to re-create packets I’ve sniffed in Wireshark). In OptoScript, it’d just look something like this:
MyString = "hello" + chr(0);
Or in an Action Block, you can use the String command “Append Character to String” where the character you’re appending would be a zero. (The help on that command also gives the OptoScript equivalent.)
BTW, although we don’t quite yet “officially” support UDP in comm handles, it’s just a matter of documenting it and lots of folks are using it all the time. Check out this post on udp for details.
Hope that helps. I hope you’ll report back on how do did (or share code! we love shared code!)
I’m trying to use the SNAP-PAC-R2 to remotely turn an outlet on and off on a power strip. The outlet states can be controlled via SNMP and I have verified this using the MIB browser Getif. If there is a way to send an SNMP message based on an OID # using OPTO gear, please let me know. I have read through the links you have posted but they mostly concern receiving an ascii string or sending a trap that contains an ascii string.
Assuming I can’t simply send a SetRequest SNMP packet with an OID, I hope to recreate the exact bit string and send that instead. However, when I sniffed the SNMP packet from Getif, the hex data contained …“30 82 00 37 02 01 00 04”… which corresponded to …“…”… on the ascii side, because those hex values don’t correspond to normal ascii characters (http://www.asciitable.com/). Therefore, I am unable to simply reverse the process and send an ascii string that corresponds to the desired hex string. Is there some way to explicitly define the bit string to be sent by UDP instead of just ascii characters?
As for an alternative to SNMP, the PDU does accept serial communication but it requires pressing the escape button to navigate the menu. I am definitely open to any suggestions.
Yes. Usually the tricky part is figuring out exactly what that magic packet should be. But since you already have that hex data, you’re most of the way there. Here’s some code I wrote for a similar experiment using OptoScript:
Of course, this is not very pretty, but it sounds like you’ll just be sending perhaps a 0 or one on that last byte (where I had [B]nYourNumberHere[/B]), so perhaps not too horrible.
The next command you’d use after this would be: TransmitString to send out sSNMPSet. You could then do a close. (Or Receive if you’re feeling really adventurous and want to try to parse the reply that comes back…)
-OptoMary
p.s. I used my favorite little free editor, Notepad++ to edit that info from Wireshark, e.g. 30 82… I deleted the left columns and right columns (hold down Alt to highlight columns). I also recorded a Notepad++ macro to add the extra OptoScript syntax like “chr(0x” to save myself some typing.
Write a macro to write your OptoScript, and enjoy more of your weekend!
Yes. Usually the tricky part is figuring out exactly what that magic packet should be. But since you already have that hex data, you’re most of the way there. Here’s some code I wrote for a similar experiment using OptoScript:
Of course, this is not very pretty, but it sounds like you’ll just be sending perhaps a 0 or one on that last byte (where I had [B]nYourNumberHere[/B]), so perhaps not too horrible.
The next command you’d use after this would be: TransmitString to send out sSNMPSet. You could then do a close. (Or Receive if you’re feeling really adventurous and want to try to parse the reply that comes back…)
-OptoMary
p.s. I used my favorite little free editor, Notepad++ to edit that info from Wireshark, e.g. 30 82… I deleted the left columns and right columns (hold down Alt to highlight columns). I also recorded a Notepad++ macro to add the extra OptoScript syntax like “chr(0x” to save myself some typing.
Write a macro to write your OptoScript, and enjoy more of your weekend!