Skip Menu |

This queue is for tickets about the Net-SNMP CPAN distribution.

Report information
The Basics
Id: 58086
Status: resolved
Worked: 2 min
Priority: 0/
Queue: Net-SNMP

People
Owner: dtown [...] cpan.org
Requestors: roycey.cheeran [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 4.0.0
Fixed in: (no value)



Subject: Unable to set Hexadecimal Value using set_request
Currently the Net::SNMP perl module supported data types are NTEGER, INTEGER32, OCTET_STRING, NULL, OBJECT_IDENTIFIER, SEQUENCE, IPADDRESS, COUNTER, COUNTER32, GAUGE, GAUGE32, UNSIGNED32, TIMETICKS, OPAQUE, COUNTER64, However, Net SNMP as such supports the following i: INTEGER, u: unsigned INTEGER, t: TIMETICKS, a: IPADDRESS o: OBJID, s: STRING, x: HEX STRING, d: DECIMAL STRING U: unsigned int64, I: signed int64, F: float, D: double Because of this difference, I am not able to set a Hexadecimal value using set_request method. The agent throws an error if I use OCTET_STRING as the data type where a hexadecimal is expected. The error received is ERROR: Failed to queue set request for host '172.22.2.1': Received inconsistentValue(12) error-status at error-index 3. Perl version is perl, v5.8.8 built for x86_64-linux-thread-multi On a Linux Machine
The Net::SNMP module supports all of the data types supported by the SNMP specifications. A "hexadecimal string" is just the human readable version of the octets that would be carried by the OCTET STRING type. In Perl you have to use the pack() function to convert the hexadecimal representation to the desired binary data. If you do not, you end up with data consisting of the binary values of the ASCII characters. $string = 'FE09'; $octet_string = pack 'H*', $string;