### Query Simulated Agent Source: https://github.com/etingof/snmpsim/blob/master/docs/source/quickstart.md Example of using the snmpwalk tool to verify the simulated agent is responding correctly. ```bash $ snmpwalk -v2c -c public 127.0.0.1:1024 system ``` -------------------------------- ### Run SNMP Simulator Daemon Source: https://github.com/etingof/snmpsim/blob/master/docs/source/quickstart.md Command to start the snmpsim-command-responder daemon, specifying the data directory and network endpoint. ```bash $ snmpsim-command-responder --data-dir=./data \ --agent-udpv4-endpoint=127.0.0.1:1024 ``` -------------------------------- ### Execute SNMP GET Request Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulation-with-variation-modules.md Example command to retrieve SNMP object values from a public simulation service using the configured variation modules. ```bash $ snmpget -v2c -c variation/virtualtable demo.snmplabs.com \ IF-MIB::ifLastChange.1 IF-MIB::ifInOctets.1 ``` -------------------------------- ### Generate Simulation Data from Agent Source: https://github.com/etingof/snmpsim/blob/master/docs/source/quickstart.md Command to record SNMP data from an existing live SNMP agent to a local file. ```bash $ snmpsim-record-commands --agent-udpv4-endpoint=demo.snmplabs.com \ --output-file=./data/public.snmprec ``` -------------------------------- ### Simulation Data Format Source: https://github.com/etingof/snmpsim/blob/master/docs/source/quickstart.md Example of the plain-text .snmprec file format used by the simulator, where each line represents an OID, type, and value. ```text 1.3.6.1.2.1.1.1.0|4|Linux 2.6.25.5-smp SMP Tue Jun 19 14:58:11 CDT 2007 i686 1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.8072.3.2.10 1.3.6.1.2.1.1.3.0|67|233425120 1.3.6.1.2.1.2.2.1.6.2|4x|00127962f940 1.3.6.1.2.1.4.22.1.3.2.192.21.54.7|64x|c3dafe61 ``` -------------------------------- ### Querying SNMP Simulator Agents Source: https://context7.com/etingof/snmpsim/llms.txt Examples of querying a running SNMP simulator using standard SNMP tools like snmpget, snmpwalk, snmpset, and snmpbulkwalk. Demonstrates querying with SNMPv2c and SNMPv3, specifying community names or context names to select data files. ```bash # Query using SNMPv2c with community name matching data file snmpget -v2c -c public localhost:1024 1.3.6.1.2.1.1.1.0 # Returns: STRING: Linux 2.6.25.5-smp SMP Tue Jun 19 14:58:11 CDT 2007 i686 # Walk entire simulated device snmpwalk -v2c -c public localhost:1024 1.3.6 # Query specific data file using directory path as community snmpwalk -v2c -c recorded/linksys-system localhost:1024 1.3.6.1.2.1.1 # Query using SNMPv3 with context name snmpwalk -v3 -l authPriv \ -u simulator -A auctoritas -X privatus \ -n public \ localhost:1024 1.3.6.1.2.1.1 # SNMP SET operation (requires writecache module) snmpset -v2c -c public localhost:1024 \ 1.3.6.1.2.1.1.4.0 s "newadmin@localhost" # SNMP GETBULK for efficient table retrieval snmpbulkwalk -v2c -c public -Cr25 localhost:1024 1.3.6.1.2.1.2.2 ``` -------------------------------- ### Generate Simulation Data from MIB Source: https://github.com/etingof/snmpsim/blob/master/docs/source/quickstart.md Command to synthesize simulation data based on a specific MIB module definition. ```bash $ snmpsim-record-mibs --output-file=./data/public.snmprec \ --mib-module=IF-MIB ``` -------------------------------- ### Invoke SNMPSim command responder with Redis module Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulation-with-variation-modules.md Demonstrates how to start the SNMPSim command responder while configuring the Redis variation module with specific connection parameters such as host, port, and database index. ```bash $ snmpsim-command-responder \ --variation-module-options=redis:host:127.0.0.1,port:6379,db:0 ``` -------------------------------- ### Install SNMP Simulator with pip Source: https://github.com/etingof/snmpsim/blob/master/docs/source/contents.md This snippet shows how to install the SNMP Simulator using pip within a virtual environment. It assumes you have Python and pip installed. ```bash $ virtualenv venv $ source venv/bin/activate $ pip install snmpsim ``` -------------------------------- ### snmpsim-command-responder Startup and Data File Scanning (Bash) Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/addressing-agents.md Shows the output of the snmpsim-command-responder when it starts up and scans for data files. It highlights how shared data files are identified and associated with specific SNMPv1/v2c community names and SNMPv3 context names, including the initialization of variation modules. ```bash snmpsim-command-responder --agent-udpv4-endpoint=127.0.0.1:1161 Scanning "/home/root/.snmpsim/variation" directory for variation modules... no directory Scanning "/usr/local/share/snmpsim/variation" directory for variation modules... 8 more modules found Initializing variation modules: notification... OK sql... FAILED: database type not specified numeric... OK subprocess... OK delay... OK multiplex... OK error... OK writecache... OK Scanning "/usr/local/share/snmpsim/data" directory for *.snmpwalk, *.MVC, *.sapwalk, *.snmprec, *.dump data files... ================================================================== Data file /usr/local/share/snmpsim/data/public.snmprec, dbhash-indexed, closed SNMPv1/2c community name: public SNMPv3 context name: 4c9184f37cff01bcdc32dc486ec36961 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Shared data file data/public.snmprec, dbhash-indexed, closed SNMPv1/2c community name: private SNMPv3 context name: 2c17c6393771ee3048ae34d6b380c5ec -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ... SNMPv3 credentials: Username: simulator Authentication key: auctoritas Authentication protocol: MD5 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 ``` -------------------------------- ### Example .snmprec File Structure (Bash) Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulating-agents.md This snippet demonstrates the typical directory structure and file organization for SNMP simulation data (.snmprec files) using the find command in bash. It shows how different types of simulation data (e.g., MIBs, foreign formats, variations) are organized. ```bash $ cd /usr/local/share $ find snmpsim/data snmpsim/data snmpsim/data/public.snmprec snmpsim/data/mib2dev snmpsim/data/mib2dev/ip-mib.snmprec snmpsim/data/mib2dev/host-resources-mib.snmprec snmpsim/data/mib2dev/tcp-mib.snmprec snmpsim/data/foreignformats snmpsim/data/foreignformats/linux.snmpwalk snmpsim/data/foreignformats/winxp.sapwalk snmpsim/data/variation snmpsim/data/variation/subprocess.snmprec snmpsim/data/variation/virtualtable.snmprec snmpsim/data/recorded snmpsim/data/recorded/linksys-system.snmprec snmpsim/data/recorded/udp-endpoint-table-walk.snmprec ... ``` -------------------------------- ### Configure Delay Module in .snmprec Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulation-with-variation-modules.md Examples of using the delay module to simulate network latency, packet drops, and conditional response delays based on request values or timestamps. ```bash 1.3.6.1.2.1.2.2.1.3.1|2:delay|value=6,wait=100,deviation=200 1.3.6.1.2.1.2.2.1.6.1|4:delay|hexvalue=00127962f940,wait=800 1.3.6.1.2.1.2.2.1.7.1|2:delay|wait=1000000 1.3.6.1.2.1.2.2.1.8.1|2:delay|vlist=eq:0:100:eq:1:1000,value=1 1.3.6.1.2.1.2.2.1.9.1|67:delay|vlist=lt:100:1:gt:300:1000000,value=150 1.3.6.1.2.1.2.2.1.10.1|67:delay|tlist=gt:1364860800:1000000,value=150 ``` -------------------------------- ### Define Redis key-space data Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulation-with-variation-modules.md Example of how OID data is structured within Redis lists using a key-space prefix. Each entry maps an OID path to a specific value format. ```bash "4321-<9 spaces>.1<9 spaces>.3<9 spaces>.6 ... <9 spaces>.3<9 spaces>.0" = "67|812981" "4322-<9 spaces>.1<9 spaces>.3<9 spaces>.6 ... <9 spaces>.3<9 spaces>.0" = "67|813181" "4323-<9 spaces>.1<9 spaces>.3<9 spaces>.6 ... <9 spaces>.3<9 spaces>.0" = "67|814233" ``` -------------------------------- ### Load SNMP Simulator Configuration from File Source: https://context7.com/etingof/snmpsim/llms.txt This snippet demonstrates how to create a configuration file for snmpsim-command-responder, specifying multiple device configurations including engine IDs, data directories, and UDP endpoints. The configuration is then loaded using the --args-from-file option. ```bash cat > /tmp/snmpsim-args.txt << EOF --v3-engine-id=auto --data-dir=./data/device1 --agent-udpv4-endpoint=127.0.0.1:10161 --v3-engine-id=auto --data-dir=./data/device2 --agent-udpv4-endpoint=127.0.0.1:10162 EOF snmpsim-command-responder --args-from-file=/tmp/snmpsim-args.txt ``` -------------------------------- ### SNMPREC File Format Specification Source: https://context7.com/etingof/snmpsim/llms.txt Defines the structure of .snmprec files, which use OID|tag|value triplets. Includes examples for various SNMP data types and encoding modifiers. ```text 1.3.6.1.2.1.1.7.0|2|72 1.3.6.1.2.1.1.1.0|4|Linux server 2.6.32-5-amd64 1.3.6.1.2.1.2.2.1.6.1|4x|001122334455 1.3.6.1.2.1.1.1.0|4e|\x00\x01hello\x02 1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.8072.3.2.10 1.3.6.1.2.1.4.20.1.1.192.168.1.1|64|192.168.1.1 1.3.6.1.2.1.2.2.1.10.1|65|1234567890 1.3.6.1.2.1.2.2.1.5.1|66|1000000000 1.3.6.1.2.1.1.3.0|67|123456789 1.3.6.1.2.1.31.1.1.1.6.1|70|9876543210123456789 1.3.6.1.2.1.2.2.1.10.1|65:numeric|initial=0,rate=1000,max=4294967295 ``` -------------------------------- ### Configure Error Module in .snmprec Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulation-with-variation-modules.md Examples of using the error module to trigger specific SNMP error codes based on operations, request values, or conditional logic. ```bash 1.3.6.1.2.1.2.2.1.1.1|2:error|op=get,status=authorizationError,value=1 1.3.6.1.2.1.2.2.1.2.1|4:error|op=set,status=commitfailed,hexvalue=00127962f940 1.3.6.1.2.1.2.2.1.3.1|2:error|vlist=gt:2:wrongvalue,value=1 1.3.6.1.2.1.2.2.1.6.1|4:error|status=noaccess ``` -------------------------------- ### Configure Activity Reporting Methods Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/command-line-options.md Configures how the SNMP simulator emits activity metrics. Supports fulljson for detailed metrics or minimaljson for aggregated data, both requiring a target directory. ```bash --reporting-method=fulljson:reports-dir --reporting-method=minimaljson:reports-dir ``` -------------------------------- ### Accessing Shared Data with Different Community Names (Bash) Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/addressing-agents.md Illustrates how to use the snmpwalk command with different community names ('public' and 'private') to access the same set of managed objects from the snmpsim responder. This demonstrates that the symbolic link configuration allows distinct credentials to interact with the same underlying data. ```bash snmpwalk -On -v2c -c public localhost:1161 1.3.6 .1.3.6.1.2.1.1.1.0 = STRING: Device description .1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.34547 .1.3.6.1.2.1.1.3.0 = Timeticks: (78171676) 9 days, 1:08:36.76 .1.3.6.1.2.1.1.4.0 = STRING: The Owner .1.3.6.1.2.1.1.5.0 = STRING: DEVICE-192.168.1.1 .1.3.6.1.2.1.1.6.0 = STRING: TheCloud .1.3.6.1.2.1.1.7.0 = INTEGER: 72 ... snmpwalk -On -v2c -c private localhost:1161 1.3.6 .1.3.6.1.2.1.1.1.0 = STRING: Device description .1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.34547 .1.3.6.1.2.1.1.3.0 = Timeticks: (78171676) 9 days, 1:08:36.76 .1.3.6.1.2.1.1.4.0 = STRING: The Owner .1.3.6.1.2.1.1.5.0 = STRING: DEVICE-192.168.1.1 .1.3.6.1.2.1.1.6.0 = STRING: TheCloud .1.3.6.1.2.1.1.7.0 = INTEGER: 72 ... ``` -------------------------------- ### Configure Redis backend in .snmprec Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulation-with-variation-modules.md Defines how to map an OID subtree to a Redis database using the :redis module. The configuration includes a key-spaces-id to manage multiple data sets. ```bash 1.3.6.1.2.1.1|:redis|key-spaces-id=1234 ``` -------------------------------- ### Send SNMP Notifications with snmpsim Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulation-with-variation-modules.md Configure snmpsim to send SNMP v1, v2c, and v3 notifications (traps and informs) based on GET or SET operations. Parameters include community, version, host, port, trap OID, and detailed varbinds with specified data types. ```bash 1.3.6.1.2.1.1.1.0|4:notification|op=get,version=1,community=public,\ proto=udp,host=127.0.0.1,port=162,ntftype=trap,\ trapoid=1.3.6.1.4.1.20408.4.1.1.2.0.432,uptime=12345,agentaddress=127.0.0.1,\ enterprise=1.3.6.1.4.1.20408.4.1.1.2,\ varbinds=1.3.6.1.2.1.1.1.0:s:snmpsim agent:1.3.6.1.2.1.1.3.0:i:42,\ value=SNMPv1 trap sender 1.3.6.1.2.1.1.2.0|6:notification|op=set,version=2c,community=public,\ host=127.0.0.1,ntftype=trap,trapoid=1.3.6.1.6.3.1.1.5.1,\ varbinds=1.3.6.1.2.1.1.1.0:s:snmpsim agent:1.3.6.1.2.1.1.3.0:i:42,\ value=1.3.6.1.1.1 1.3.6.1.2.1.1.3.0|67:notification|version=3,user=usr-md5-des,authkey=authkey1,\ privkey=privkey1,host=127.0.0.1,ntftype=inform,trapoid=1.3.6.1.6.3.1.1.5.2,\ value=123456 ``` -------------------------------- ### Configure Variation Module Options Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/command-line-options.md Sets configuration parameters for variation modules using colon-separated arguments. Allows for aliasing modules to support multiple configurations for the same module type. ```bash --variation-module-options=sql=mydb:dbtype:sqlite3,database:/tmp/snmpsim.db ``` -------------------------------- ### Configure SNMP Simulator with Multiple Endpoints (Bash) Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulating-agents.md This command configures the snmpsim-command-responder to listen on both IPv4 and IPv6 interfaces. It specifies the IP address and port for each endpoint. The example uses an unprivileged port (1024) to avoid requiring root privileges. ```bash $ snmpsim-command-responder --agent-udpv4-endpoint=127.0.0.1:1024 \ --agent-udpv6-endpoint='[::1]:1161' ``` -------------------------------- ### Implement Lua scripting for Redis Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulation-with-variation-modules.md Demonstrates loading a Lua script into Redis using SCRIPT LOAD and invoking it via evalsha. This allows for custom logic during SNMP GET/SET operations. ```lua if table.getn(ARGV) > 0 then return redis.call('set', KEYS[1], ARGV[1]) else return redis.call('get', KEYS[1]) end ``` ```bash 1.3.6.1.2.1.1|:redis|key-spaces-id=1234,evalsha=d94bf1756cda4f55bac9fe9bb872f # Loading the script redis-cli script load "..." # Executing via evalsha evalsha "d94bf1756cda4f55bac9fe9bb872f" 1 "4321|1.3.6.1.2.1.2.1.1.0" "4|linksys router" ``` -------------------------------- ### Configure SNMPv3 Engine ID Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulating-agents.md This example shows how to set a custom SNMPv3 snmpEngineId for the snmpsim tool. The snmpEngineId is normally generated automatically but can be specified via the command line using the --v3-engine-id option. The value must adhere to RFC3411 standards. ```bash $ snmpsim-command-responder --agent-udpv4-endpoint=127.0.0.1 \ --v3-engine-id=010203040505060809 Scanning "/home/user/.snmpsim/variation" directory for variation modules... ... SNMPv3 EngineID 0x010203040505060809 ------------------------------------------------------------------ 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:161, transport ID 1.3.6.1.6.1.1.0 ``` -------------------------------- ### Creating Symbolic Links for .snmprec Files (Bash) Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/addressing-agents.md Demonstrates how to create a symbolic link to an existing .snmprec file. This allows the linked file to be used as an alternative CommunityName/ContextName for accessing the managed objects from the original snapshot file. This is a standard Linux/Unix command-line operation. ```bash ls -l public.snmprec -rw-r--r-- 1 root users 8036 Mar 12 23:26 public.snmprec ln -s public.snmprec private.snmprec ls -l private.snmprec lrwxrwxrwx 1 root users 14 Apr 5 20:58 private.snmprec -> public.snmprec ``` -------------------------------- ### Display Multiplex main configuration file Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/recording-with-variation-modules.md Shows the content of the generated .snmprec file which acts as the entry point for the multiplex simulation. ```bash $ cat data/multiplex.snmprec 1.3.6.1.2.1.2|:multiplex|period=15.00,dir=data/multiplex ``` -------------------------------- ### SNMPSim Multiple SNMP Engine Configuration Source: https://context7.com/etingof/snmpsim/llms.txt Demonstrates configuring and running multiple independent SNMP engines within a single SNMP Simulator process. Each engine can have its own engine ID, user credentials, transport endpoints, and data directories. ```bash # Run two separate SNMP engines on different ports snmpsim-command-responder \ --v3-engine-id=010203040505060809 \ --v3-user=user1 --v3-auth-key=authkey111 \ --data-dir=./data/engine1 \ --agent-udpv4-endpoint=127.0.0.1:1161 \ --v3-engine-id=090807060504030201 \ --v3-user=user2 --v3-auth-key=authkey222 \ --data-dir=./data/engine2 \ --agent-udpv4-endpoint=127.0.0.1:1162 ``` -------------------------------- ### Query Simulated Device via SNMPv2c (Bash) Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulating-agents.md This command uses snmpwalk to query a simulated device configured on the SNMP Simulator daemon. It specifies the SNMP version (v2c), community string, and the target host and port. The output shows the queried MIB information. ```bash $ snmpwalk -On -v2c -c recorded/linksys-system localhost:1161 1.3.6 .1.3.6.1.2.1.1.1.0 = STRING: BEFSX41 .1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.3955.1.1 .1.3.6.1.2.1.1.3.0 = Timeticks: (638239) 1:46:22.39 .1.3.6.1.2.1.1.4.0 = STRING: Linksys .1.3.6.1.2.1.1.5.0 = STRING: isp-gw .1.3.6.1.2.1.1.6.0 = STRING: 4, Petersburger strasse, Berlin, Germany .1.3.6.1.2.1.1.8.0 = Timeticks: (4) 0:00:00.04 .1.3.6.1.2.1.1.8.0 = No more variables left in this MIB View ... ``` -------------------------------- ### Record SNMP Agent Commands with snmpsim-record-commands (Bash) Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/building-simulation-data.md This command-line tool records SNMP agent responses by executing GETNEXT queries for a specified OID range. It supports SNMPv1, v2c, and v3. The output is stored in a `.snmprec` file, which can be used for simulation. For better performance, consider using the `--use-getbulk` option. ```bash $ snmpsim-record-commands --agent-udpv4-endpoint=192.168.1.1 \ --start-oid=1.3.6.1.2.1 --stop-oid=1.3.6.1.2.1.5 \ --output-file=snmpsim/data/recorded/linksys- \ system.snmprec Scanning "/usr/local/share/snmpsim/variation" directory for variation modules... none requested SNMP version 2c Community name: public Querying UDP/IPv4 agent at 192.168.1.1:161 Sending initial GETNEXT request.... OIDs dumped: 304, elapsed: 1.94 sec, rate: 157.00 OIDs/sec $ $ ls -l data/recorded/linksys-system.snmprec -rw-r--r-- 1 root users 16252 Oct 26 14:49 data/recorded/linksys-system.snmprec $ $ head data/recorded/linksys-system.snmprec 1.3.6.1.2.1.1.1.0|4|BEFSX41 1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.3955.1.1 1.3.6.1.2.1.1.3.0|67|638239 1.3.6.1.2.1.1.4.0|4|Linksys 1.3.6.1.2.1.1.5.0|4|isp-gw 1.3.6.1.2.1.1.6.0|4|4, Petersburger strasse, Berlin, Germany 1.3.6.1.2.1.1.8.0|67|4 ``` ```bash $ snmpsim-record-commands --agent-udpv4-endpoint=demo.snmplabs.com \ --community=public SNMP version 2c, Community name: public Querying UDP/IPv4 agent at 195.218.195.228:161 Sending initial GETNEXT request.... 1.3.6.1.2.1.1.1.0|4|SunOS zeus.snmplabs.com 4.1.3_U1 1 sun4m 1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.20408 1.3.6.1.2.1.1.3.0|67|137765775 1.3.6.1.2.1.1.4.0|4|SNMP Laboratories, info@snmplabs.com 1.3.6.1.2.1.1.5.0|4|zeus.snmplabs.com 1.3.6.1.2.1.1.6.0|4|San Francisco, California, United States ... 1.3.6.1.2.1.11.31.0|65|0 1.3.6.1.2.1.11.32.0|65|0 OIDs dumped: 86, elapsed: 2.00 sec, rate: 42.00 OIDs/sec ``` -------------------------------- ### Query Simulated Device via SNMPv3 (Bash) Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulating-agents.md This command uses snmpwalk to query a simulated device using SNMPv3. It specifies the SNMP version (v3), security level (authPriv), username, authentication protocol and key, privacy protocol and key, and the target host and port. The '-n' parameter is used to address a specific simulated device. ```bash $ snmpwalk -On -v3 -n recorded/linksys-system \ -l authPriv -u simulator -A auctoritas -X privatus \ localhost:1161 1.3.6 .1.3.6.1.2.1.1.1.0 = STRING: BEFSX41 .1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.3955.1.1 .1.3.6.1.2.1.1.3.0 = Timeticks: (638239) 1:46:22.39 .1.3.6.1.2.1.1.4.0 = STRING: Linksys .1.3.6.1.2.1.1.5.0 = STRING: isp-gw .1.3.6.1.2.1.1.6.0 = STRING: 4, Petersburger strasse, Berlin, Germany .1.3.6.1.2.1.1.8.0 = Timeticks: (4) 0:00:00.04 .1.3.6.1.2.1.1.8.0 = No more variables left in this MIB View ... ``` -------------------------------- ### Connect SNMPSim to MySQL Database (TCP/IP) Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulation-with-variation-modules.md Sets up SNMPSim to connect to a MySQL database using TCP/IP. This requires the MySQL Connector/Python driver and a running MySQL server with specified credentials. ```bash $ snmpsim-command-responder \ --variation-module-options=sql:dbtype:mysql.connector,\n host:127.0.0.1,port:3306,user:snmpsim,password:snmpsim,database:snmpsim ``` -------------------------------- ### Record SNMP data with Delay variation module Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/recording-with-variation-modules.md Demonstrates how to use the snmpsim-record-commands tool with the delay module to capture and simulate request processing times for SNMP objects. ```bash $ snmpsim-record-commands --agent-udpv4-endpoint=demo.snmplabs.com \ --start-oid=1.3.6.1.2.1.2 --stop-oid=1.3.6.1.2.1.3 \ --variation-module=delay ``` -------------------------------- ### Configure Multiple SNMPv3 USM Users Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulating-agents.md This snippet demonstrates how to configure multiple SNMPv3 USM users for the snmpsim tool. Each user is defined by a set of --v3-user, --v3-auth-key, and --v3-priv-key parameters. All users share the same view and permissions, but can be differentiated using contextNames or transport endpoints. ```bash $ snmpsim-command-responder --agent-udpv4-endpoint=127.0.0.1 \ --v3-user=wallace --v3-auth-key=testkey123 --v3-priv-key=testkey839 \ --v3-user=gromit --v3-auth-key=testkey564 --v3-priv-key=testkey6534 Scanning "/home/user/.snmpsim/variation" directory for variation modules... ... SNMPv3 EngineID 0x80004fb8056372617927fb76cc ------------------------------------------------------------------ SNMPv3 USM SecurityName: wallace SNMPv3 USM authentication key: testkey123, authentication protocol: MD5 SNMPv3 USM encryption (privacy) key: testkey839, encryption protocol: DES ------------------------------------------------------------------ SNMPv3 USM SecurityName: gromit SNMPv3 USM authentication key: testkey564, authentication protocol: MD5 SNMPv3 USM encryption (privacy) key: testkey6534, encryption protocol: DES Listening at UDP/IPv4 endpoint 127.0.0.1:161, transport ID 1.3.6.1.6.1.1.0 ... ``` -------------------------------- ### SNMPSim OID Mapping to SQL Table Source: https://github.com/etingof/snmpsim/blob/master/docs/source/documentation/simulation-with-variation-modules.md Illustrates how to map a subtree of OIDs to a specific SQL database table for handling by the SNMPSim SQL module. This allows a single .snmprec file line to manage multiple OIDs from a database. ```text 1.3.6.1.2.1.1|:sql|snmprec ```