Closed Scrafya closed 1 year ago
There are quite a few pysnmp packages out there on PyPI. Which packages did you install for this test? Please use pip list
to show that.
Solved the issue, the problem was installation. I thought just an installation would do the trick but i guess you do need a venv. If you can however answer how i can set oid values to selected oid that'd be great.
Running the server and trying to access the oid by snmpset returns me No such Instance error. I have also tried launching it with variation module options to create a db for the changes to no avail.
Got the same error:
Installed with:
virtualenv venv
source venv/bin/activate
pip install snmpsim
Running local or inside a docker container. Running with:
snmpsimd.py --data-dir=./data --agent-udpv4-endpoint=127.0.0.1:1024
I see similar problems on macOS with python3.11 from Homebrew when executing snmprec:
python3 -m venv venv
. venv/bin/activate
pip install snmpsim
snmprec.py ...
Also tried using python3.8 from Homebrew, but same issue:
python3.8 -m venv venv
. venv/bin/activate
pip install snmpsim
snmprec.py ...
I eventually gave up and just launched an Ubuntu 22.04 container in Docker and used apt-get install snmpsim
to get something functional.
I see similar problems on macOS with python3.11 from Homebrew when executing snmprec:
python3 -m venv venv . venv/bin/activate pip install snmpsim snmprec.py ...
Also tried using python3.8 from Homebrew, but same issue:
python3.8 -m venv venv . venv/bin/activate pip install snmpsim snmprec.py ...
I eventually gave up and just launched an Ubuntu 22.04 container in Docker and used
apt-get install snmpsim
to get something functional.
please, can you show your Dockerfile and how to run the container to make it work?
There wasn't a Dockerfile involved, it was just an interactive container so I could grab a few snmprec recordings:
docker image pull ubuntu:22.04
docker run -it --rm ubuntu:22.04
apt-get update
apt-get install snmpsim
snmprec ...
docker cp <containerid>:/<snmprec_file> ./<snmprec_file>
For those that are experiencing this issue, do the tutorial step by step. You need to run it on a venv with the right dependancies.
Can you point at where the tutorial is located?
Trying to navigate to http://snmplabs.com/snmpsim/
as linked in the README.md (https://github.com/etingof/snmpsim#documentation) leads to a redirect that is blocked by uBlock Origin in my browser, which doesn't inspire confidence...
Keep in mind that while this tool is good for just serverside applications its not very useful for customization for individual devices. I would recommend using https://github.com/delimitry/snmp-server alongside docker to achieve multiple agent support whilst being able to customize the codebase to your needs.
What part of the following does not match https://snmplabs.thola.io/snmpsim/quickstart.html#installation?
python3 -m venv venv
. venv/bin/activate
pip install snmpsim
snmprec.py --agent-udpv4-endpoint=w.x.y.z:161 --community=xxx --start-object=1.3.6.1.2.1.1.1 --stop-object=1.3.6.1.2.1.1.5 --output-file=foo
...
ERROR TypeError: decodeMessageVersion.<locals>.<lambda>() takes 3 positional arguments but 4 were given;
Am I missing something?
Its been a while since ive solved the issue my memory doesnt serve me well but i think i installed it manually from this repo and not from snmpsim. I remember seeing that the install of the snmpsim library is not up to date. If this is not the case i would suggest using ChatGPT to debug as it pointed out where the dependency issues were.
So the problem appears to be the latest version of pyasn1 (0.5.0) that gets installed if you just pip install snmpsim
is not compatible.
The fix appears to be manually install the older 0.4.8 release first:
python3 -m venv venv
. venv/bin/activate
pip install pyasn1==0.4.8
pip install snmpsim
Has this solved the issue?
If you use the forked package
snmpsim-lextudio
and https://pysnmp.com, you might find there are less troubles.More details can be found in etingof/pysnmp#429
Yes, this seems to work for me w/o any of the previous issues, thank you!
python3 -m venv venv
. venv/bin/activate
pip install snmpsim-lextudio
snmpsim-record-commands --agent-udpv4-endpoint=w.x.y.z:161 --community=xxx --start-object=1.3.6.1.2.1.1.1 --stop-object=1.3.6.1.2.1.1.5 --output-file=foo
So the problem appears to be the latest version of pyasn1 (0.5.0) that gets installed if you just
pip install snmpsim
is not compatible.The fix appears to be manually install the older 0.4.8 release first:
python3 -m venv venv . venv/bin/activate pip install pyasn1==0.4.8 pip install snmpsim
Thank you so much, this worked! So the problem is with pyasn1 (0.5.0), just need to downgrade the version, for anyone who still having issues.
A summary of the issue is,
pyasn1
0.5.0-rc, and that broke pysnmp
and snmpsim
. By switching to a virtual environment, probably that environment only pulled down production pyasn1
(0.4.x at that time), so the issue was resolved and closed.pyasn1
0.5.0 was released by its new maintainers a few days ago, which in turn breaks more pysnmp
4.4.x users like @EricChandia and @norrisjeremy. The solution you found is of course to downgrade pyasn1
to 0.4.x.In the long run, we will see what happens on pyasn1
side. The maintainers are so new that they probably need more time to learn enough about the package.
If you like, you can read https://github.com/etingof/pysnmp/issues/429 to learn more about the entire ecosystem today. Sites like https://snmplabs.thola.io/snmpsim/ are rather problematic as their owners didn't really want to take over the bits. You might check out https://pysnmp.com and the *-lextudio
packages maintained by my team.
snmpsim-command-responder --data-dir=./data --agent-udpv4-endpoint=127.0.0.1:1024
The server runs, also invoking the responder.py file with related commands successfully opens the service,
While using snmpwalk or cmd2rec however the server side crashes with the provided image. I am guessing its a dependancy issue that i couldnt get a hold of. I am running python 3.10.6 with the latest versions of whatever software is required.