serge123 has asked for the wisdom of the Perl Monks concerning the following question:
I'm having an issue with Net:SNMP and retreiving values listed as Hex-STRING. Here's a unix snmpwalk which looks OK:
snmpwalk -v 2c -c COMM 10.1.1.1 1.3.6.1.4.1.9.9.273.1.2.1.1.16
SNMPv2-SMI::enterprises.9.9.273.1.2.1.1.16.1.11.97.108.105.97.110.116.95.119.105.102.105.0.19.206.233.215.61 = Hex-STRING: 0A 40 12 81
SNMPv2-SMI::enterprises.9.9.273.1.2.1.1.16.1.11.97.108.105.97.110.116.95.119.105.102.105.0.144.75.10.176.166 = Hex-STRING: 0A 40 12 45
SNMPv2-SMI::enterprises.9.9.273.1.2.1.1.16.1.11.97.108.105.97.110.116.95.119.105.102.105.0.144.150.180.214.183 = Hex-STRING: 0A 40 12 96
SNMPv2-SMI::enterprises.9.9.273.1.2.1.1.16.1.11.97.108.105.97.110.116.95.119.105.102.105.0.144.150.182.172.193 = Hex-STRING: 0A 40 12 87
Here's the same walk with perl:
perl walktest.pl (walking 1.3.6.1.4.1.9.9.273.1.2.1.1.16)
Trying 'snmpwalk' on 10.1.1.1
1.11.97.108.105.97.110.116.95.119.105.102.105.0.19.206.233.215.61:
@
1.11.97.108.105.97.110.116.95.119.105.102.105.0.144.75.10.176.166:
@E
1.11.97.108.105.97.110.116.95.119.105.102.105.0.144.150.180.214.183:
@
1.11.97.108.105.97.110.116.95.119.105.102.105.0.144.150.182.172.193:
@
I get similar weird results if I do an snmpget with perl on 1 OID:
perl test.pl
1.3.6.1.4.1.9.9.273.1.2.1.1.2.1.11.97.108.105.97.110.116.95.119.105.102.105.0.19.206.233.215.61 = bÚZ`
Either way, the “Hex-STRING” data is never returned correctly. This happens with any OID holding a “Hex-STRING”. I don't have a problem with other OID types. At first I thought it was just a formatting issue so I played with printing the output using “hex” but it didn’t help. There also aren't enough chars sent back to be a formatting issue. I wonder if Net::SNMP can’t handle an OID value with a space in it?
The perl code I'm using looks like this:
use strict; use Net::SNMP; use BER; use SNMP_Session; use SNMP_util; #variable declaration and assigment omitted... print "Trying 'snmpwalk' on $host\n"; @ret = &snmpwalk("$community\@$host\:\:\:\:\:$version", $oid ); foreach (@ret) { print "$_\n"; }
As you can see I've been trying various SNMP modules. I've always get the same problem regardless of which way I query to OID.
Any help you can provide would be appreciated.
Thanks,
Serge
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Net::SNMP not retreiving Hex-STRING correctly
by Argel (Prior) on Mar 09, 2006 at 23:38 UTC | |
Re: Net::SNMP not retreiving Hex-STRING correctly
by atcroft (Abbot) on Mar 09, 2006 at 23:58 UTC | |
Re: Net::SNMP not retreiving Hex-STRING correctly
by serge123 (Initiate) on Mar 10, 2006 at 17:30 UTC | |
Re: Net::SNMP not retreiving Hex-STRING correctly
by ikegami (Patriarch) on Jun 29, 2007 at 15:10 UTC |