IBM Support

How to use SNMPSim to simulate a network device based on an SNMP walk file

How To


Summary

SNMP Simulator is an open source SNMP simulator in the vein of Mimic™.
It can be used to simulate parts or complete SNMP MIBs from a device.
One purpose would be to present a simulation of a customer's device for trouble-shooting ITNM.
SNMP Simulator can present OIDs and their values to the ITNM discovery engine, or poller.

Steps

1. Installing SNMP Simulator (snmpsim)

pip install snmpsim

Note: You can install snmpsim as root, but you cannot it run as root.
If you do not have pip installed, you can do that using python

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

 
2. Using snmpsim
The caveats for this worked example are:
i. The user running snmpsim is called 'netcool'
ii. You have an SNMP walk of the MIBs or entire device that was created using Net-Snmp Utils tool 'snmpwalk'
iii. The SNMP walk file was created using the flags -One in order to ensure the output can be converted by snmpsim
snmpwalk -One -v 1 -c public 10.10.4.1 [oid]  >  test.snmpwalk
2.1 Setting up snmpsim to use your walk file:
su - netcool
mkdir .snmpsim/data
mv test.snmpwalk ~netcool
 
Convert the test.snmpwalk to a snmprec file, a format that snmpsim can read
datafile.py --input-file test.snmpwalk --source-record-type=snmpwalk --output-file ./public.snmprec
 
If there are no errors, put that file into ~netcool/.snmpsim/data
 
cp public.snmprec  ~netcool/.snmpsim/data
It is important to note the name of the snmprec file.  
You should name this file according to the community string you plan to use in discovering this simulated device.
This worked example names the device 'public.snmprec'.
This means that the community string your SNMP query tool should use is 'public'.
If you are querying these MIB values using ITNM, then you need to specify public in the Passwords tab or in SnmpStackSecuritySchema.DOMAIN.cfg
If you are using the Net-SNMP utility 'snmpget' then you need to use -c public .
3. Start the snmpsim daemon as user netcool on the local IP address, on port 1024
You are not obliged to use port 1024.  But you are running as non-root so, unless you give your user sudo, then they won't have access to the low end ports.
Remember to update the SNMP port value in ITNM to match this value.

snmpsimd.py --agent-udpv4-endpoint=10.21.1.135:1024
 
There is a lot of output concluding with ...
Listening at UDP/IPv4 endpoint 10.21.1.135:1024, transport ID 1.3.6.1.6.1.1.0
Now you can query any OID in test.snmpwalk using v2c and community string "public" (which is the name of the snmprec file).
 
snmpget -c public -v1 10.21.1.135:1024 1.3.6.1.4.1.28634.5.3395486743.2.9157.0
SNMPv2-SMI::enterprises.28634.5.3395486743.2.9157.0 = INTEGER: 91
 
 

Document Location

Worldwide

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSSHRK","label":"Tivoli Network Manager IP Edition"},"Component":"","Platform":[{"code":"PF016","label":"Linux"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
28 January 2020

UID

ibm11125789