In this part:
($type eq 'string') && do { $value = encode_string($value); push @enoid, [$oid,$value]; next; };
You process the oids of type string (e.g. $value = '9A 20 FF 19'). One must assume that encode_string is not encoding as it should.
If you have root access somewhere on the path between the host performing the SNMP gets and the router, run tcpdump with something like:
tcdump -nvv port 161
And do a get with HPOV, and likewise with your perl script. Hopefully it will be obvious what needs to be done. Either you're calling encode_String incorrectly, or you can do the same much more efficiently with pack.
This latter approach was one I adopted when playing around with MRTG. It comes with a module for dealing with the nitty-gritty of speaking SNMP. The perl code for assembling and disassembling SNMP packets is some of the most unnecessarily convoluted and poorly structured code it has been my misfortune to lay my eyes upon.
I just checked: SNMP_Session, the one and same. The code is just abysmal. MRTG is nice, though :)
In reply to Re: SNMP String format
by grinder
in thread SNMP String format
by mugster
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |