snmpwalk -v 2c -c public -ObentU x.y.z.w . > x.y.z.w.raw.snmpwalk
snmpwalk -v 2c -c public x.y.z.w . > x.y.z.w.translated.snmpwalk
Source: http://snmplabs.com/snmpsim/building-simulation-data.html#snmpwalk-dumpMy file is "369.snmpwalk" and I want to simulate this device.
Make sure snmpwalk is installed:
yum -y install net-snmp-utils
Install pip:curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py" && python get-pip.py
Install snmpsim python module:pip install snmpsim
Add new user "snmpd":groupadd snmpd
useradd -g snmpd snmpd
mkdir -p /var/log/snmpd
chown -R snmpd:snmpd /var/log/snmpd
Open port in firewall:firewall-cmd --add-port=1024/udp --permanent
firewall-cmd --reload
Make sure ther is data directory:mkdir -p /usr/share/snmpsim/data
Move "369.snmpwalk" to data dir:mv *.snmpwalk /usr/share/snmpsim/data
or move manually to this dir and create a file:cd /usr/share/snmpsim/data
vi device1.snmpwalk
To check out if the file is suitable for symulator:datafile.py --source-record-type=snmpwalk --input-file=device1.snmpwalk
If the device has a lot of junk HEX values then remove those:sed -i '/^[0-9ABCDEF]/d' device1.snmpwalk
It may also show 'value evaluation error for tag 'COUNTER32:', value '0 instances'. to fix it:
grep instances device1.snmpwalk
sed -i 's/ instances//g' device1.snmpwalk
grep failures device1.snmpwalk
sed -i 's/ failures//g' device1.snmpwalk
all together:
sed -i 's/ instances\| failures\| notifications//g' device1.snmpwalk
"device1" will be the community name.Set the right owner:
chown -R snmpd:snmpd /usr/share/snmpsim
Launch similator to serve at port 1024:snmpsimd.py --process-user=snmpd --process-group=snmpd --logging-method=file:/var/log/snmpd/snmpsimd.log --agent-udpv4-endpoint=127.0.0.1:1024
If you trying to walk from diferent station then 127.0.0.1 needs to me changed to local address like 10.0.2.5:snmpsimd.py --process-user=snmpd --process-group=snmpd --logging-method=file:/var/log/snmpd/snmpsimd.log --agent-udpv4-endpoint=10.0.2.5:1024
Open another terminal and take a look on log:cat /var/log/snmpd/snmpsimd.log
Test if walk on port 1024 is OK:snmpwalk -v2c -cdevice1 127.0.0.1:1024 .1.3.6.1.2.1
Sometimes it is nice to clean log before fresh start:> /var/log/snmpd/snmpsimd.log
tail -f /var/log/snmpd/snmpsimd.log
if receive:snmpsim.error.SnmpsimError: Data error at /usr/share/snmpsim/data/WS-C3750G-24TS.snmpwalk:1: broken record
Then check *.snmpwalk first line. it should start all with:.1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.9.1.516
.1.3.6.1.2.1.1.3.0 = Timeticks: (371624784) 43 days, 0:17:27.84
.1.3.6.1.2.1.1.4.0 = STRING:
.1.3.6.1.2.1.1.5.0 = STRING: Switch-1.labenv.localdomain
.1.3.6.1.2.1.1.6.0 = STRING:
.1.3.6.1.2.1.1.7.0 = INTEGER: 6
If log files shows:ERROR Problem with data file or its index: Failed to create /tmp/snmpsim/_usr_share_snmpsim_data_device4.dbm for data file /usr/share/snmpsim/data/device4.snmpwalk: (13, 'Permission denied')
Try:chown -R snmpd:snmpd /tmp/snmpsim