etingof / snmpsim

SNMP Simulator

Home Page:http://snmplabs.com/snmpsim/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setting the variation module directory gives errors

nightlyteacups opened this issue · comments

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.

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>

@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 )