Forum Archive

pythonista snmpget

dacabemo

Hi everyone!
Before I purchase pythonista for IOS I would like to know if is it possible to get values by snmp, as snmpget.

I need to control the state of several equipments getting their values by snmp and today I can only get it by SSH to a Linux server and working with the values returned by this server. I'm looking the option to make it only with IOS with no more equipments and no jailbreak. I saw pythonista as a good language to interact with IOS but I cannot find if there is a snmpget script

Thank so so much for your time!

cvp

@dacabemo I guess it should be possible with this pure Python library

dacabemo

Thank you @cvp . Does it work with IOS-Pythonista APP or only with Python code? It seems so easy, but with IOS APP I don't know if I can install pure Python libraries ($ pip install pysnmp). I've never work before with Python, excuse me if the question is so easy. Thanks a lot again!

JonB

You can install stash, then use pip. One thing you need to check is whether that library uses raw sockets. Doesn't look like it, but that would be the other thing that iOS prohibits.

ccc

See comments from the author of pysnmp
https://github.com/etingof/pysnmp/pull/321#issuecomment-550520450

dacabemo

Thank you all for your time and comments. Thanks @JonB by solving how to use it with stash. It seems so easy. Thanks @ccc by comment away with @etingof. It’s not clear it will run on IOS devices. I understand could it work, but I suppose it should be tested. I will try to get Phytonista and test it. Again, thank you so much!

dacabemo

Hi everyone again!

I'm focused on this but I had an issue that stopped me. May you help me please?

I got this error

StaSh v0.7.4 on python 3.6.1
Warning: you are running StaSh in python3. Some commands may not work correctly in python3.
Please help us improving StaSh by reporting bugs on github.
Tip: A background job can be issued by appending & at the end of a normal command, e.g. httpserver &
[~/Documents]$ pip install pysnmp
Querying PyPI ...
Downloading package ...
Opening: https://files.pythonhosted.org/packages/25/7e/1e17facea54dd21c6a72db6ae57a5bfdd56edd54b8c4850668b554bdddba/pysnmp-4.4.12-py2.py3-none-any.whl

Save as: /private/var/mobile/Containers/Data/Application/D9FDBFE8-AAA1-428A-BE12-FAA9FDCA3613/tmp//pysnmp-4.4.12-py2.py3-none-any.whl (296498 bytes)
[====================] 100.00% | 289.5KiB
Installing wheel: pysnmp-4.4.12-py2.py3-none-any.whl...
Package installed: pysnmp
Dependency already installed: pysmi
Installing dependency: pycryptodomex (required by: pysnmp)
Querying PyPI ...
Downloading package ...
Opening: https://files.pythonhosted.org/packages/f5/79/9d9206688385d1e7a5ff925e7aab1d685636256e34a409037aa7adbbe611/pycryptodomex-3.9.8.tar.gz

Save as: /private/var/mobile/Containers/Data/Application/D9FDBFE8-AAA1-428A-BE12-FAA9FDCA3613/tmp//pycryptodomex-3.9.8.tar.gz (15633485 bytes)
[====================] 100.00% | 14.9MiB
Extracting archive file ...
Archive extracted.
Running setup file ...
Testing support for clang
AttributeError("'ShIO' object has no attribute 'fileno'",)
Failed to run setup.py
Fall back to directory guessing ...
Error: Cannot locate packages. Manual installation required.
[~/Documents]$

Sure you could save me... thanks in advance