[SNMP4J] create snmp simulator

Frank Fock fock at agentpp.com
Thu Jun 17 18:19:55 CEST 2010


Hi,

(1) An object identifier (OID) does not start with a dot (".").
That notation has been invented by the NET-SNMP
team, but is not standard conform and thus not
used by SNMP4J.

(2) You can use StaticMOGroup instead individually
registering scalars (saves memory).

Best regards,
Frank

On 17.06.2010 10:07, simon simon wrote:
> Hi..
> 
> I tried the testAgent demo supplied by the Snmp4jAgent.
> Not really sure how it works yet. Kinda complicated at least for me.
> 
> Anyway,
> I've created a simple apps. One is the agent and the other is client 
> which sends the pdu and get the response from agent.
>  From what I've told earlier, I would like to add in all the oids and 
> its value to the agent.
> 
> I've done that but not sure it's correct or incorrect (I can't find 
> sample code for what I've wanted). The code for that is as follow
> 
> public void registerCustomMO() {
> 
> String key = "";
> Iterator iterator = oid_values.keySet().iterator();
> while(iterator.hasNext()) {
> key = (String) iterator.next();
> try {
> server.register( new MOScalar(new OID("."+key),
> MOAccessImpl.ACCESS_READ_ONLY,
> new OctetString((String) oid_values.get(key))),
> new OctetString((String) oid_values.get(key)));
> } catch (DuplicateRegistrationException e) {
> e.printStackTrace();
> }
> 
> }
> }
> 
> 
> For example in my agent, I registered
> oid = 1.3.6.1.2.1.1.1.0 = Hardware: x86 Family 15 Model 6 Stepping 5 
> AT/AT COMPATIBLE - Software: Windows Version 5.2 (Build 3790 
> Multiprocessor Free)
> 1.3.6.1.2.1.1.3.0 = 65 days, 0:21:29.42
> 
> Once I've started the Agent. I ran the client.
> 
> In the GET PDU, I requested value for oid "1.3.6.1.2.1.1.1.0".
> What I get is "Windows XP .....".
> 
> For oid "1.3.6.1.2.1.1.3.0", I got like "0:00:3.xxxx". (Coincidentally 
> reflect the duration that the agent has been running).
> 
> So I guess it's still not registering or I'm doing something wrong here?
> Do guide me.
> 
> Thx.
> Simon
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> Hotmail: Trusted email with powerful SPAM protection. Sign up now. 
> <https://signup.live.com/signup.aspx?id=60969>

-- 
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list