My goal is to simulate an agent using snmpsim
from snmpsim.
In that respect I walked an SNMP device and captured the output in a file, mydevice.snmprec
.
According to the instruction from snmpsim, I suppose to start the agent invoking snmpsimd.py --agent-udpv4-endpoint=127.0.0.1:1161
. The problem is that this command does not point to mydevice.snmprec
.
Any idea how include mydevice.snmprec
as part of the command to simulate the agent?
Just is case someone might come across the same issue, here is what I did to simulate the agent and the manager:
net-snmp
via port install net-snmp
for CLI manager. Also got a MIB Broswer for MAC.snmpsim
to simulate the agentsudo snmprec.py --agent-udpv4-endpoint=10.1.1.10 --start-oid=1.3.6.1.4.1 --stop-oid=1.3.6.1.4.30 --use-getbulk --output-file=snmpsim/data/mydevice.snmprec
$ pwd
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/snmpsim-0.2.4-py2.7.egg/snmpsim
$ ls
__init__.py confdir.pyc data grammar record
__init__.pyc daemon.py error.py log.py variation
confdir.py daemon.pyc error.pyc log.pyc
$ tree
.
├── __init__.py
├── __init__.pyc
├── confdir.py
├── confdir.pyc
├── daemon.py
├── daemon.pyc
├── data
│ ├── mydevice.snmprec
│ ├── foreignformats
│ │ ├── linux.snmpwalk
│ │ ├── winxp1.snmpwalk
│ │ └── winxp2.sapwalk
$ snmpsimd.py --data-dir=data --agent-udpv4-endpoint=127.0.0.1:1161
You should see something like these which represent the last lines where the agent is waiting for queries:
……………
………………..
………….
SNMPv3 USM SecurityName: simulator
SNMPv3 USM authentication key: auctoritas, authentication protocol: MD5
SNMPv3 USM encryption (privacy) key: privatus, encryption protocol: DES
Listening at UDP/IPv4 endpoint 127.0.0.1:1161, transport ID 1.3.6.1.6.1.1.0
$ snmpwalk -On -v2c -c mydevice 127.0.0.1:1161 .1.3.6.1.4.1
At this point you should see the agent reacting to the query and manager displaying whatever the agent sends back.
Also, you can do the same thing from a MIB browser manager.
Note: This supports read-only operations!
I haven't got the part where one can write to the simulated agent, yet. I will post it if I can get it working.