How do I create an agent (or snmp simulator) using a "MIB walk"?

Last modified by Frank Fock on 2024/05/25 12:38

With SNMP4J and SNMP4J-Agent you can create a simulation agent from a real agent in two steps:

1. Create a MIB walk snapshot file

A snapshot file can be created with SNMP4J-CLTSNMP4J, and MIB Explorer Pro. The following examples illustrate the commands necessary to save a snapshot file with SNMP4J-CLT from an agent that listens on the localhost interface on port 161:

java -jar SNMP4J-CLT.jar -v 2c -c public create-snapshot /tmp/mibdump.sf 127.0.0.1/161 1.3.6

With MIB Explorer Pro, you can use the MIB browser GUI to walk a subtree (or several independent subtrees, even from different agents) and combine those variables into a snapshot file. You can also compare snapshot files and view their content.

_Note: To use a snapshot file stored by MIB Explorer Pro with SNMP4J-Agent, you need to convert it into the SNMP4J snapshot format first. For MIB Explorer 2.x snapshot files download the converter from https://agentpp.com/tools/mibexplorer/SnapshotConv.jar and run it with:

java -jar SnapshotConv.jar [-h] <mibexplorer-snaphost-file> <snmp4j-snapshot-file> 

2. Run the SNMP4J-Agent Snapshot-Agent with the created file

The following command line starts an agent listening on all interfaces on port 4700 which is provides the MIB variables collected in the file /tmp/mibdump.sf:

java -cp SNMP4J-agent.jar;SNMP4J.jar org.snmp4j.agent.test.SnapshotAgent /tmp/mibdump.sf 0.0.0.0/4700

This agent can be then browsed using SNMP4J-CLT with:

java -jar SNMP4J-CLT.jar -v 2c -c public walk 127.0.0.1/4700 1.3.6