SNMP Simulator

raw JSON →
1.2.2 verified Mon Apr 27 auth: no python

snmpsim is a tool that simulates SNMP agents, acting as a multitude of devices from an SNMP manager's perspective. Version 1.2.2 supports Python 3.10-3.11 (requires python: <4.0,>=3.10). It is under active maintenance with occasional releases.

pip install snmpsim
error No module named 'pysnmp'
cause pysnmp is a required dependency but not automatically installed.
fix
Run pip install pysnmp separately or use pip install snmpsim[pysnmp] if available.
error ImportError: cannot import name 'SmiManager' from 'pysnmp'
cause Common mistake: importing from pysnmp instead of snmpsim.
fix
Use from snmpsim import SmiManager.
breaking snmpsim 1.0+ removed support for Python 2 and older Python 3 versions. Requires Python 3.10+.
fix Upgrade Python to 3.10+ and use snmpsim >=1.0.0.
deprecated The `snmpsimd` command-line script has been deprecated. Use `snmpsim-command-responder` instead.
fix Replace `snmpsimd` with `snmpsim-command-responder` in scripts and documentation.
gotcha Data directory must follow a specific structure (e.g., subdirectories for each simulated agent) or the simulator may silently fail.
fix Ensure each agent has its own folder with files like 'snmp_v1.snmprec', 'snmp_v2c.snmprec', etc.

Starts the SNMP simulator with a local agent endpoint and data directory.

from snmpsim.commands import main
import sys

if __name__ == '__main__':
    sys.argv = ['', '--agent-udpv4-endpoint=127.0.0.1:161', '--data-dir=./data']
    main()