[Pkg-net-snmp-devel] Bug#581185: libsnmp-python: I get errors when using snmpgetnext or snmpwalk

Tomas Penicka Tomas.Penicka at cz.flextronics.com
Tue May 11 12:36:41 UTC 2010


Package: libsnmp-python
Version: 5.4.2.1~dfsg-5+b1
Severity: important
Tags: squeeze

When using the python bindings for net-snmp, I get errors when using
snmpgetnext or snmpwalk. All installed software is from standard Debian
distribution

Detailed description:
I try to communicate with a network device via SNMP. I send the same
commands using command line tools and then using Python module libsnmp.
The system is configured in such a way that I don't need to enter
information about MIBS and paths on the commandline.

The following command are taken form tutorial on
http://www.net-snmp.org/wiki/index.php/TUT:snmpwalk

##############################################
On Debian Squeeze:
==============================================
Scenario 1: command line

~$ snmpget --version
NET-SNMP version: 5.4.2.1

~$ ip="192.168.52.221:160"
~$ com="public"

~$ snmpwalk -v 2c -c $com $ip sysDescr
RFC1213-MIB::sysDescr.0 = STRING: "Some description"

~$ snmpgetnext -v 2c -c $com $ip sysDescr
RFC1213-MIB::sysDescr.0 = STRING: "Some description"



Everything works as expected


==============================================
Scenario 2: libsnmp in Python, snmpgetnext
~$ python
Python 2.5.5 (r255:77872, Apr 21 2010, 08:44:16) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import netsnmp
>>> oid = netsnmp.Varbind('sysDescr')
>>> ip="192.168.52.221:160"
>>> com="tester"
>>> 
>>> res = netsnmp.snmpwalk(oid, Version = 2, DestHost = ip, Community =
com); res
error: walk: unknown python error (varlist)>>> 
>>> res = netsnmp.snmpwalk(oid, Version = 2, DestHost = ip, Community =
com); res
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: expected string or Unicode object, NoneType found
>>> 

An error occurs. Notice that I get a different error after the second
try.

==============================================
Scenario 3: libsnmp in Python, snmpwalk

~$ python
Python 2.5.5 (r255:77872, Apr 21 2010, 08:44:16) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import netsnmp
>>> oid = netsnmp.Varbind('sysDescr')
>>> ip="192.168.52.221:160"
>>> com="tester"
>>> res = netsnmp.snmpgetnext(oid, Version = 2, DestHost = ip, Community
= com); res
error: get: unknown python error>>> 
>>> res = netsnmp.snmpgetnext(oid, Version = 2, DestHost = ip, Community
= com); res
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: expected string or Unicode object, NoneType found

The same problem as in Scenario 2

##############################################
On Debian Lenny

It works as expected (the same results as from commandline). Below is a
version of SNMP and python

~$ snmpget --version
NET-SNMP version: 5.4.1
~$ python
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-trunk-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libsnmp-python depends on:
ii  libc6                  2.10.2-6          Embedded GNU C Library:
Shared lib
ii  libsnmp15              5.4.2.1~dfsg-5+b1 SNMP (Simple Network
Management Pr
ii  python                 2.5.4-9           An interactive high-level
object-o
ii  python-central         0.6.14+nmu2       register and build utility
for Pyt

libsnmp-python recommends no packages.

libsnmp-python suggests no packages.

-- no debconf information


Legal Disclaimer:
The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-net-snmp-devel/attachments/20100511/a9467fd7/attachment.htm>


More information about the Pkg-net-snmp-devel mailing list