Google+

SNMP Simulator Project Logo
SNMP Simulator introduction
Producing SNMP snapshots
Simulating SNMP Agents
Transport-based variation
Sharing snapshots
MIB-based simiulation
Simulation based on captured traffic
Simulation with variation modules
Recording with variation modules
Managing data files
Large scale simulation
Tips and tricks
Download & Install
License
Changelog
Github repo
Adding features
Sponsorship
Simulation Service
Contact
Get SNMP Simulator at SourceForge.net. Fast, secure and Free Open Source software downloads

Producing SNMP snapshots

Primary method of recording an SNMP snapshot is to run snmprec tool against your donor device. This tool will execute a series of SNMP GETNEXT queries for a specified range of OIDs over a chosen SNMP protocol version and store response data in a text file.

Data file format is optimized to be compact, human-readable and inexpensive to parse. It's also important to store full and exact response information in a most intact form. Here's an example data file content:

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

There is a pipe-separated triplet of OID-tag-value items where:

  • OID is a dot-separated set of numbers.
  • Tag is a BER-encoded ASN.1 tag. When value is hexified, an 'x' literal is appended. Reference to a variation module can also be embedded into tag.
  • Value is either a printable string, a number or a hexifed value.

Valid tag values and their corresponding ASN.1/SNMP types are:

  • Integer32 - 2
  • OCTET STRING - 4
  • NULL - 5
  • OBJECT IDENTIFIER - 6
  • IpAddress - 64
  • Counter32 - 65
  • Gauge32 - 66
  • TimeTicks - 67
  • Opaque - 68
  • Counter64 - 70

Data file recording would look like this:

$ snmprec.py  -h
Synopsis:
  SNMP Agents Recording tool. Queries specified Agent, stores response
  data in data files for subsequent playback by SNMP Simulation tool.
  Can store a series of recordings for a more dynamic playback.
Documentation:
  http://snmpsim.sourceforge.net/snapshotting.html
Usage: scripts/snmprec.py [--help]
    [--version]
    [--debug=<mibbuild|all|app|msgproc|proxy|io|secmod|dsp|acl|mibinstrum>]
    [--logging-method=<stdout|stderr|syslog|file>[:args>]]
    [--protocol-version=<1|2c|3>]
    [--community=<string>]
    [--v3-user=<username>]
    [--v3-auth-key=<key>]
    [--v3-auth-proto=<SHA|MD5>]
    [--v3-priv-key=<key>]
    [--v3-priv-proto=<3DES|AES256|DES|AES|AES128|AES192>]
    [--context=<string>]
    [--use-getbulk]
    [--getbulk-repetitions=<number>]
    [--agent-udpv4-endpoint=<X.X.X.X:NNNNN>]
    [--agent-udpv6-endpoint=<[X:X:..X]:NNNNN>]
    [--agent-unix-endpoint=</path/to/named/pipe>]
    [--start-oid=<OID>] [--stop-oid=<OID>]
    [--output-file=<filename>]
    [--variation-modules-dir=<dir>]
    [--variation-module=<module>]
    [--variation-module-options=<args>]

$
$ snmprec.py --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 ilya 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

There are no special requirements for device file name and location. Note, that Simulator treats device file path as an SNMPv1/v2c community string and its MD5 hash constitutes SNMPv3 context name.

If you don't readily have SNMP Agent to play with, you're welcome to use online SNMP Simulator:

$ snmprec.py --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|Moscow, Russia
...
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

About three times faster snapshot recording may be achieved by using SNMP's GETBULK operation:

$ snmprec.py --agent-udpv4-endpoint=demo.snmplabs.com --use-getbulk 
--output-file=data/recorded/linksys-system.snmprec

Faster recording may be important for capturing changes to Managed Objects at better resolution.

You could always modify your data files with a text editor.

If you wish to contribute such a snapshot - please, run snmprec for your device and send me its output file. Make sure that your device does not have any private information.


Need help? Try snmpsim mailing lists or contact us.