[SNMP4J] enable SNMP monitoring for Java app with existing MBeans

Frank Fock fock at agentpp.com
Thu Feb 21 20:53:38 CET 2013


Hi David,

You need to send a SNMP SET PDU to trigger an action.
With GET you get only the current state of the action adapter object.

Best regards,
Frank

Am 21.02.2013 19:04, schrieb david pocivalnik:
> Hi Frank,
>
> thanks for the explanations. I left only open issues (for readability)
> and commented inline.
>
> On 2/21/2013 1:25 AM, Frank Fock wrote:
>> Please find my comments inline below:
>> Am 19.02.2013 11:10, schrieb david pocivalnik:
>>> but, I don't understand some details.
> [...]
>>> - the OID's I'm using start with "1.3.6.1.4.", when adding a View (in
>>> the agent, vacm.addViewTreeFamily) I thought that when removing
>>> vacm.addViewTreeFamily(new OctetString("fullReadView"), new OID("1.3"),
>>> new OctetString(), VacmMIB.vacmViewIncluded, StorageType.nonVolatile);
>>> I would only get an error back, but I again received the value.
>> It seems that there is another view associated with the group mapped to
>> your user that allows access to the OID.
> I haven't checked that yet.
>
>>> - with SNMP it is possible to set and get values, but just to be sure, i
>>> can't call a method from an SNMP manager that returns void, but executes
>>> the method called?
>> SNMP4J-AgentJMX provides MBeanActionMOScalarSupport to support actions
>> (= method call)
>> on scalars:
>> http://www.snmp4j.org/agentJMX/doc/org/snmp4j/agent/mo/jmx/MBeanActionMOScalarSupport.html
>> The mapping of the action parameters is provided through MBeanActionInfo.
> thanks. I added
>
> private static final Object[][] SCALAR_MBEANS_IMP_ACTIONS = {
> 		{ TestManagementMib.oidImpCall, 			new MBeanStateInfo[] { new
> MBeanStateInfo(2, null, null) },
> new MBeanActionInfo[] { new MBeanActionInfo(3, "startImport", new
> Object[0]) }}};
>
> scalarSupportActions.addAll(onameImp, SCALAR_MBEANS_IMP_ACTIONS);
>
> impCall = moFactory.createScalar(oidImpCall,
> 				moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_WRITE), new
> Integer32());
>
> to the designated methods, as done for SCALAR_MBEANS_JVM_MEMORY_ACTIONS
> in your example. The only problem, I can't seem to execute the method.
> I'm sure that's a problem with the snmp call. I tried with
>
> libexec/check_snmp -H dp -C public -o .1.3.6.1.4.1.42.2.145.3.163.1.1.2.3.0
> (script by nagios) and
> snmpget -c public -v 2c dp .1.3.6.1.4.1.42.2.145.3.163.1.1.2.3.0
>
> which should call gc(), but in both cases the response is
>
> SNMP OK - 2 | iso.3.6.1.4.1.42.2.145.3.163.1.1.2.3.0=2 ,
> iso.3.6.1.4.1.42.2.145.3.163.1.1.2.3.0 = INTEGER: 2 respectively.
>
> the same is true for the method I tried to call in my small test
> application, which should just print something on the console of the
> agent when called.
>
> i couldn't think of any other method that I could use. Do you have any
> idea what command to use to execute a method?
>
> Thanks in advance 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