This page describes how-to integrate AgenPro generated code for SNMP4J-Agent into an agent's main program.
Not Applicable for Maven-Task-Pluign Usage
Although this description uses AgenPro Maven-Plugin files, it steps described herein are not useful when actually also using the AgenPro-Maven-Plugin. The plugin facilitates already many of the below steps. Please read the AgenPro Manual for details.
The code has been generated by AgenPro into a folder that can be used to further develop the agent software. Otherwise, modifications to the generated code cannot be (easily) integrated into regenerated code, for example if there is a MIB specification update.
For this tutorial that gen-folder is
C:\Users\myuser\Documents\agenpro4\generated\snmp4j\src\org\snmp4j\agent\tutorial.You can replace the name gen-folder in the following by this folder.
- Optionally: Install the latest SNMP4J.jar, SNMP4J-Agent.jar, and optionally SNMP4J-AgentX.jar in a lib directory. For this tutorial we use
C:\Users\myuser\Documents\agenpro4\libfor that. You can dowload latest release JARs from the AGENT++ Maven repository at: https://oosnmp.net/dist/release.
- Install Java JDK (the JRE is not sufficient, because you need the Java compiler).
- Optionally: Install Maven 3.x. Note: If you do not install Maven, you need to perform step 2 and manually compile the sources (not explained here).
- If you have already a main program for your SNMP4J-Agent ready, then continue with step ?? of the Step-by-step Guide below.
Optionally: Only if you are using your own main agent program implementation, you need first to fix the import section as described in the box below and then add the following function
registerMIBs()to that class:
Then call the above function in your agent initialization code before the agent is actually started with agent.run():
Compile the sources with Maven:
Run the agent:
or alternatively without Maven support: