Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting the variation module directory gives errors #131

Open
nightlyteacups opened this issue Mar 17, 2020 · 2 comments
Open

Setting the variation module directory gives errors #131

nightlyteacups opened this issue Mar 17, 2020 · 2 comments

Comments

@nightlyteacups
Copy link

nightlyteacups commented Mar 17, 2020

Hi,
I'm trying to get the variation modules to work, particularly writecache one, because as far as I know it provides the ability to modify values with SET request. I was having issues with that: the values didn't change, and I saw that snmpsim can't find variation modules (the same as #129). I didn't copy the folder, as described in the post, but decided to set the directory path in params (just because I don't have to copy anything in that case), but I got some errors:

pi@raspberrypi:~/snmpsim-0.4.7 $ snmpsim-command-responder --data-dir=./data --variation-modules-dir=./variation --agent-udpv4-endpoint=127.0.0.1:1024
Using "NullReporter" activity reporting method with params  
Scanning "./variation" directory for variation modules... 
ERROR Variation module "/home/pi/snmpsim-0.4.7/variation/writecache.py" execution failure: No module named mltsplit 
Initializing variation modules... 
Traceback (most recent call last):
  File "/usr/local/bin/snmpsim-command-responder", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/snmpsim/commands/responder.py", line 510, in main
    variation_modules, mode='variating')
  File "/usr/local/lib/python2.7/dist-packages/snmpsim/variation.py", line 256, in initialize_variation_modules
    for name, modules_contexts in variation_modules.items():
AttributeError: 'int' object has no attribute 'items'

I have to run snmpsim from the folder, because pip install didn't work for me either (#57), but I also tried to run install.py script and it did install something, judging by the terminal output (although variation directory still can't be detected automatically).
I'm using latest release (0.4.7), latest 2.7.x Python on Raspbian OS and trying to change values with a v2c SET request from a custom program on golang (everything else works fine except for SET when I don't specify the variation directory).
Help would be highly appreciated.

Thanks in advance.

@nightlyteacups
Copy link
Author

Tried SET with net-snmp, got No Such Instance, eventhough there IS such instance:

pi@raspberrypi:~ $ snmpset -v2c -On -c public 127.0.0.1:1024 1.3.6.1.2.1.25.3.2.1.3.1281 s "cjl"
.1.3.6.1.2.1.25.3.2.1.3.1281 = No Such Instance currently exists at this OID
pi@raspberrypi:~ $ snmpget -v2c -On -c public 127.0.0.1:1024 1.3.6.1.2.1.25.3.2.1.3.1281
.1.3.6.1.2.1.25.3.2.1.3.1281 = STRING: ljc
pi@raspberrypi:~ $ snmpset -v2c -On -c public 127.0.0.1:1024 1.3.6.1.2.1.25.3.7.1.4.1552.3 i 1234567890
.1.3.6.1.2.1.25.3.7.1.4.1552.3 = No Such Instance currently exists at this OID
pi@raspberrypi:~ $ snmpget -v2c -On -c public 127.0.0.1:1024 1.3.6.1.2.1.25.3.7.1.4.1552.3
.1.3.6.1.2.1.25.3.7.1.4.1552.3 = INTEGER: 67291060 KBytes

Log shows:

Using ./data/public.snmprec controller selected by candidate 4c9184f37cff01bcdc32dc486ec36961; transport ID 1.3.6.1.6.1.1.0, source address 127.0.0.1, context engine ID self, community name "4c9184f37cff01bcdc32dc486ec36961" 
SNMP EngineID 0x80004fb80572617370626572727970697c670670, transportDomain (1, 3, 6, 1, 6, 1, 1, 0), transportAddress ('127.0.0.1', 52216), securityModel 2, securityName 4c9184f37cff01bcdc32dc486ec36961, securityLevel 1 
Opening ./data/public.snmprec controller 
Request var-binds: 1.3.6.1.2.1.25.3.2.1.3.1281=<cjl>, flags: EXACT, SET 
Response var-binds: 1.3.6.1.2.1.25.3.2.1.3.1281=<No Such Instance currently exists at this OID> 
Using ./data/public.snmprec controller selected by candidate 4c9184f37cff01bcdc32dc486ec36961; transport ID 1.3.6.1.6.1.1.0, source address 127.0.0.1, context engine ID self, community name "4c9184f37cff01bcdc32dc486ec36961" 
SNMP EngineID 0x80004fb80572617370626572727970697c670670, transportDomain (1, 3, 6, 1, 6, 1, 1, 0), transportAddress ('127.0.0.1', 46751), securityModel 2, securityName 4c9184f37cff01bcdc32dc486ec36961, securityLevel 1 
Request var-binds: 1.3.6.1.2.1.25.3.2.1.3.1281=<>, flags: EXACT, GET 
Response var-binds: 1.3.6.1.2.1.25.3.2.1.3.1281=<ljc> 

Using ./data/public.snmprec controller selected by candidate 4c9184f37cff01bcdc32dc486ec36961; transport ID 1.3.6.1.6.1.1.0, source address 127.0.0.1, context engine ID self, community name "4c9184f37cff01bcdc32dc486ec36961" 
SNMP EngineID 0x80004fb80572617370626572727970697c670670, transportDomain (1, 3, 6, 1, 6, 1, 1, 0), transportAddress ('127.0.0.1', 38010), securityModel 2, securityName 4c9184f37cff01bcdc32dc486ec36961, securityLevel 1 
Request var-binds: 1.3.6.1.2.1.25.3.7.1.4.1552.3=<1234567890>, flags: EXACT, SET 
Response var-binds: 1.3.6.1.2.1.25.3.7.1.4.1552.3=<No Such Instance currently exists at this OID> 
Using ./data/public.snmprec controller selected by candidate 4c9184f37cff01bcdc32dc486ec36961; transport ID 1.3.6.1.6.1.1.0, source address 127.0.0.1, context engine ID self, community name "4c9184f37cff01bcdc32dc486ec36961" 
SNMP EngineID 0x80004fb80572617370626572727970697c670670, transportDomain (1, 3, 6, 1, 6, 1, 1, 0), transportAddress ('127.0.0.1', 38249), securityModel 2, securityName 4c9184f37cff01bcdc32dc486ec36961, securityLevel 1 
Request var-binds: 1.3.6.1.2.1.25.3.7.1.4.1552.3=<>, flags: EXACT, GET 
Response var-binds: 1.3.6.1.2.1.25.3.7.1.4.1552.3=<67291060>

@tkekan
Copy link

tkekan commented Sep 25, 2020

@nightlyteacups Hey I hit similar issue when using the command from the readme.

snmpsim-command-responder --data-dir=./data --agent-udpv4-endpoint=127.0.0.1:1024

Please refer the full issue here : #150
Could you pelase let me know whats the workaround here ? Am I missing something in the installation part ?
I'm installing all these in a virtualenv ( -p = python2.7 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants