[SNMP4J] agent-jmx - method call with arguments

david pocivalnik dp.desoma at gmail.com
Mon Mar 4 16:37:21 CET 2013


Hi Frank,

ok, thanks for the information.

BR
David

On 3/1/2013 1:34 AM, Frank Fock wrote:
> 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
>




More information about the SNMP4J mailing list