[SNMP4J] MOScalar question

Frank Fock fock at agentpp.com
Fri Aug 18 13:06:29 CEST 2006


Hi Jose,

You may download AgenPro and read the included
SNMP4J-Agent-Instrumentation-HowTo PDF for further
details on how to instrument a MOScalar.

One approach could be to overwrite the getValue()
method of you MOScalar to call the getValue() method
you already implemented. But there other approaches
described too in the above document.

Best regards,
Frank

Jose Ignacio wrote:
> Hello, i'm new to SNMP and I'm making examples to understand snmp4j from
> TestAgent, my constructor is:
> 
>    public MyAgent(File bootCounterFile, File configFile) throws IOException
> {
>        super(bootCounterFile, configFile, new CommandProcessor(
>                new OctetString(MPv3.createLocalEngineID())));
>        // Alternatively: OctetString.fromHexString("00:00:00:00:00:00:02",
>        // ':');
>        agent.setThreadPool(ThreadPool.create("RequestPool", 4));
> 
>        OID oidParamTest1 = new OID(new int[] { 1, 3, 6, 1, 4, 1, 1, 1, 2,
>                1, 0 });
>        MOScalar paramTest1 = new MOScalar(oidParamTest1,
>                MOAccessImpl.ACCESS_READ_ONLY, getValue());
>        try {
>            server.register(paramTest1, null);
> 
>        } catch (DuplicateRegistrationException e) {
>            e.printStackTrace();
>        }
>    }
> 
> and getValue method:
> 
>    private Variable getValue() {
>        return new OctetString(""+System.currentTimeMillis());
>    }
> 
> 
> The problem is that the agent's response is the same always. What I have to
> do to change the agent response?
> 
> 
> Thanks much in advance, and sorry for my english,
> JiCa.
> _______________________________________________
> 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




More information about the SNMP4J mailing list