[SNMP4J] novice help
Eugene Swank
eswank at solectek.com
Mon Sep 11 19:10:34 CEST 2006
Frank,
I began by running the agent and then changing the value to 2(config). Everything seemed to work ok, but when I do a SNMP Walk I do not seem my custom MIB. When I shut down the agent and run it for a second time, it give me the following message Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at org.snmp4j.smi.OctetString.get(OctetString.java:177)
at org.snmp4j.agent.mo.snmp.DateAndTime.makeCalendar(DateAndTime.java:13
7)
at org.snmp4j.agent.mo.snmp4j.example.Snmp4jHeartbeatMib$Snmp4jAgentHBRe
fTime.setValue(Snmp4jHeartbeatMib.java:361)
at org.snmp4j.agent.mo.MOScalar.load(MOScalar.java:305)
at org.snmp4j.agent.io.MOServerPersistence.readData(MOServerPersistence.
java:128)
at org.snmp4j.agent.io.MOServerPersistence.loadData(MOServerPersistence.
java:80)
at org.snmp4j.agent.BaseAgent.loadConfig(BaseAgent.java:265)
at org.snmp4j.agent.BaseAgent.loadConfig(BaseAgent.java:238)
at org.snmp4j.agent.test.TestAgent.main(TestAgent.java:343)
When I ran the AgenPro program and imported the created java file into the code I got an error during the build (something to do with the a data type I think), the only way I could get the file to compile without any errors was by changing the data type of one of my objects from a Octet String to an Integer (I used the IFMIB as a reference). Did I mess something up by doing this? I used the java file that AgenPro generated, but it would only work if I changed this data type. Any suggestions?
Thanks,
Gene
_____
From: Frank Fock [mailto:fock at agentpp.com]
To: eswank at solectek.com
Cc: snmp4j at agentpp.org
Sent: Wed, 06 Sep 2006 14:09:52 -0700
Subject: Re: [SNMP4J] novice help
You can load the AGENTPP-SIMULATION-MIB (see
http://www.agentpp.com/agentpp3_5/mibs/mibs.html) into
MIB Explorer to easily set the value from the MIB tree.
On the other hand, you can also use the OID directly
and create a PDU to set the value.
Using the SNMP4J console tool is also an option.
Best regards,
Frank
Eugene Swank wrote:
> Thanks for the help, my only remaining question is how do I set the
> instance 1.3.6.1.4.1.4976.2.1.1.0 to config(2). Do I need to load one of
> the mibs into the MIB Explorer Pro to do this? Sorry I am still pretty
> new to this.
>
> ------------------------------------------------------------------------
> *From:* Frank Fock [mailto:fock at agentpp.com]
> *To:* eswank at solectek.com
> *Cc:* snmp4j at agentpp.org
> *Sent:* Tue, 05 Sep 2006 13:00:56 -0700
> *Subject:* Re: [SNMP4J] novice help
>
> Hi Gene,
>
> With SNMP4J-Agent 1.0 (which has now been released!) you can build
> an simulation agent as follows:
>
> 1. Compile your MIB with AgenPro into its repository.
> 2. Load the MIB module into AgenPro's MIB tree.
> 3. Select the root node of your MIB module (if you want to
> simulate more than one MIB module repeat this for each module)
> and create a property (with the Properties tab) with name "simulation"
> and set its value to "yes".
> 4. Open the snmp4j_by_selection project.
> 5. Edit the project settings and add the MIB modules you want
> to simulate in the 3rd step of the wizard.
> 6. Run the code generation.
> 7. In directory snmp4j/src for each selected MIB module a .java file
> will have been created.
> 8. Copy those files into a package directory of your choice and add
> the necessary package construct to the sources.
> 9. Copy the TestAgent.java implementation into your new project and
> replace occurrences of IfMib by your MIB module(s). (In fact you
> register the MIB modules at the TestAgent).
> 10. Run the agent.
> 11. If you have an existing agent that implements the MIBs (or parts
> of them), then use MIB Explorer Pro to take a snapshot from the agent.
> Otherwise go directly to 12.
> 12. Use MIB Explorer, another MIB browser or SNMP4J to set
> instance 1.3.6.1.4.1.4976.2.1.1.0 to config(2).
> 13. Either apply the values from the snapshot using MIB Explorer Pro's
> restore snapshot feature or set the values to simulate using SNMP4J
> or a browser by using SNMP. In config mode, even non-writable objects
> can be written and created.
>
> AgenPro 2 is a code generator for SNMP4J-Agent and can be tried out
> from http://www.agentpp.com MIB Explorer can be checked out from
> http://www.mibexplorer.com None of these products are required to
> build a simulation agent with SNMP4J-Agent, but they help a lot.
>
> To create a simulation agent manually, you should start with the
> JavaDoc for the SimMOFactory.
>
> Hope this helps.
>
> Best regards,
> Frank
>
> Eugene Swank wrote:
> > Everyone,
> > I am very new to SNMP4j and I have a question that may seem very
> novice, but I am confused about a few things. I am building an
> Element Management System for a wireless product, but the product is
> still months away from beta. In the mean time I want to develop a
> SNMP Agent to Simulate the network elements. I have been playing
> around with the SNMP4j agent code, but I am kinda lost when it comes
> to adding my own personal MIBs to the software. Is there a built in
> MIB compiler? I am able to use the test class that come with the
> product and perform simple gets and sets to it, but how do I
> simulate my MIB?
> >
> > Any help would be very much appreciated..
> > Thanks,
> >
> > Gene
> > _______________________________________________
> > SNMP4J mailing list
> > SNMP4J at agentpp.org
> > http://lists.agentpp.org/mailman/listinfo/snmp4j
>
> --
> AGENT++
> http://www.agentpp.com
> http://www.mibexplorer.com
> http://www.mibdesigner.com
>
--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list