Open itchykun opened 6 years ago
Hi, do you think you can try to install nelkit 0.0.4 and test with that version?
I think I know what's going on and it might be an old bug with earlier versions of nelsnmp.
[root@lab ~]# pip install -U nelkit Collecting nelkit Downloading nelkit-0.0.4.tar.gz Requirement already up-to-date: argparse in /usr/lib/python2.7/site-packages (from nelkit) Requirement already up-to-date: nelsnmp>=0.2.7 in /usr/lib/python2.7/site-packages (from nelkit) Requirement already up-to-date: PyYAML in /usr/lib64/python2.7/site-packages (from nelkit) Requirement already up-to-date: pysnmp>=4.3.1 in /usr/lib/python2.7/site-packages (from nelsnmp>=0.2.7->nelkit) Requirement already up-to-date: pycryptodome in /usr/lib64/python2.7/site-packages (from pysnmp>=4.3.1->nelsnmp>=0.2.7->nelkit) Requirement already up-to-date: pysmi in /usr/lib/python2.7/site-packages (from pysnmp>=4.3.1->nelsnmp>=0.2.7->nelkit) Collecting pyasn1>=0.2.3 (from pysnmp>=4.3.1->nelsnmp>=0.2.7->nelkit) Downloading pyasn1-0.3.6-py2.py3-none-any.whl (63kB) 100% |████████████████████████████████| 71kB 5.7MB/s Collecting ply (from pysmi->pysnmp>=4.3.1->nelsnmp>=0.2.7->nelkit) Downloading ply-3.10.tar.gz (150kB) 100% |████████████████████████████████| 153kB 4.9MB/s Installing collected packages: nelkit, pyasn1, ply Found existing installation: nelkit 0.0.3 Uninstalling nelkit-0.0.3: Successfully uninstalled nelkit-0.0.3 Running setup.py install for nelkit ... done Found existing installation: pyasn1 0.3.2 Uninstalling pyasn1-0.3.2: Successfully uninstalled pyasn1-0.3.2 Found existing installation: ply 3.4 DEPRECATION: Uninstalling a distutils installed project (ply) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project. Uninstalling ply-3.4: Successfully uninstalled ply-3.4 Running setup.py install for ply ... done Successfully installed nelkit-0.0.4 ply-3.10 pyasn1-0.3.6
lab$ nk-snmp-deviceinfo -H hostname -P 3 -L authPriv -a SHA -X AES -U v3PDTuser -A pass_auth -X pass_priv
Traceback (most recent call last):
File "/usr/bin/nk-snmp-deviceinfo", line 11, in
found the issue. option -O isn't optional, it's mandatory. Also "standard" and "with_status" give the same results. Thanks
Hi, I think the problem is that there's a bug in the code which parses arguments.
Can you change to a small "-x" for the encryption algorithm? I.e -x AES
instead of -X AES
?
The -o option is probably a visual bug after copying some of the code from another library I have (nelmon).
To be honest it was a while since I looked at this code and it would need a cleanup in order to be a bit more robust.
Hi,
Thank you for writing this useful tool. However, I can't get nk-snmp-deviceinfo to work properly. I installed it without error but when I tried to use it against my SNMPv3 device (Arista, Cisco, Junos, doesn't matter), I get the same error every time.
lab$ nk-snmp-deviceinfo -H hostname -P 3 -L authPriv -a SHA -X AES -U v3PDTuser -A pass_auth -X pass_priv
Traceback (most recent call last): File "/usr/bin/nk-snmp-deviceinfo", line 11, in
load_entry_point('nelkit==0.0.3', 'console_scripts', 'nk-snmp-deviceinfo')()
File "/usr/lib/python2.7/site-packages/nelkit/cli/snmp_deviceinfo.py", line 15, in main
hostinfo.get_all()
File "/usr/lib/python2.7/site-packages/nelsnmp/hostinfo/device.py", line 46, in get_all
data = self._snmp.get(*oids)
File "/usr/lib/python2.7/site-packages/nelsnmp/snmp.py", line 232, in get
cmdGen = cmdgen.CommandGenerator()
File "/usr/lib/python2.7/site-packages/pysnmp/entity/rfc3413/oneliner/cmdgen.py", line 168, in init
self.snmpEngine = snmpEngine or SnmpEngine()
File "/usr/lib/python2.7/site-packages/pysnmp/entity/engine.py", line 63, in init
self.msgAndPduDsp = MsgAndPduDispatcher()
File "/usr/lib/python2.7/site-packages/pysnmp/proto/rfc3412.py", line 32, in init
'SNMP-TARGET-MIB', 'SNMP-USER-BASED-SM-MIB'
File "/usr/lib/python2.7/site-packages/pysnmp/smi/builder.py", line 362, in loadModules
self.loadModule(modName, userCtx)
File "/usr/lib/python2.7/site-packages/pysnmp/smi/builder.py", line 330, in loadModule
'MIB module \"%s\" load error: %s' % (modPath, traceback.format_exception(sys.exc_info()))
pysnmp.smi.error.MibLoadError: MIB module "/usr/lib/python2.7/site-packages/pysnmp/smi/mibs/SNMPv2-MIB.pyc" load error: ['Traceback (most recent call last):\n', ' File "/usr/lib/python2.7/site-packages/pysnmp/smi/builder.py", line 325, in loadModule\n exec (modData, g)\n', ' File "/tmp/pip-build-jhHD1l/pysnmp/pysnmp/smi/mibs/SNMPv2-MIB.py", line 27, in \n', ' File "/usr/lib/python2.7/site-packages/pysnmp/proto/rfc1902.py", line 206, in subtype\n return univ.OctetString.subtype(self, args, kwargs).setFixedLength(self.getFixedLength())\n', ' File "/usr/lib/python2.7/site-packages/pyasn1/type/base.py", line 122, in subtype\n value = self._value\n', "AttributeError: 'DisplayString' object has no attribute '_value'\n"]