[SNMP4J] agent-jmx - method call with arguments

Frank Fock fock at agentpp.com
Fri Mar 1 01:34:13 CET 2013


Hi David,

If you really need to pass a value of an object as parameter to a JMX method
then you will have to code that yourself. There is no mapping schema for
that which you can use.

The MBeanActionInfo takes three parameters:

1. The action ID that maps the enumerated value of the SNMP MIB object to
an action (= method name + parameter set).
2. The method name to call when the action is triggered by a SNMP set 
command.
3. The list (array) of parameters to provide to the method.

In your example, you specified a single null parameter but with type 
"Object"
instead of "String" which was expected by the method. I think that might 
have
been the cause for the Exception.

Best regards,
Frank

Am 28.02.2013 09:31, schrieb david pocivalnik:
> Hi,
>
> I've defined a method call that doesn't take any arguments 
> successfully. Now I defined the following method
>
> void startExport(String s);
>
> and created the MOScalar as the one w/o any arguments
>
> expCall = moFactory.createScalar(oidExpCall, 
> moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_WRITE), new 
> Integer32());
>
> and registered it.
>
> in the *Inst.java class I added the OID to the ACTION_OIDS and created 
> the following array:
>
> private static final Object[][] SCALAR_MBEANS_EXP_ACTIONS = {
> { TestManagementMib.oidExpCall,
> new MBeanStateInfo[] { new MBeanStateInfo(2, null, null) },
> new MBeanActionInfo[] { new MBeanActionInfo(4, "startExport", new 
> Object[1]) } } };
>
> I figured the first parameter in the new MBeanActionInfo can't be the 
> same as the one used previously (which was 3), thus I increased it. 
> Also, I though the integer in the Object[] defines the number of 
> arguments that the method takes, thus i set it to one.
>
> finally I added SCALAR_MBEANS_EXP_ACTIONS to scalarSupportActions.
>
> Something must be wrong, as the Agent isn't starting. The following 
> error:
> Exception in thread "main" java.lang.ExceptionInInitializerError
>
> when I set the number of arguments to 0 (Object[0]) then the agent 
> starts successfully, but i can't pass along any argument, e.g.
>
> $ snmpget someOID s myStringToPass
>
> Thanks for any hints and BR
> david
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231




More information about the SNMP4J mailing list