[SNMP4J] snmp vs jmx

Frank Fock fock at agentpp.com
Tue Oct 24 23:46:46 CEST 2006


As a small appetizer for the JMX API I provide an
example code to instrument the jvmClassesLoadedCount
MIB object of the JVM-MANAGEMENT-MIB with the new
API:

..
     JMXDefaultMOFactory jmxFactory = new JMXDefaultMOFactory(
       ManagementFactory.getPlatformMBeanServer());
     JvmManagementMib.moFactory = jmxFactory;
     MBeanAttributeMOScalarSupport scalarSupport =
         new MBeanAttributeMOScalarSupport(jmxFactory.getServer());
     jmxFactory.setScalarSupport(scalarSupport);
     try {
// The following code instruments a scalar with JMX:
       scalarSupport.add(JvmManagementMib.oidJvmClassesLoadedCount,
         new MBeanAttributeMOInfo(
		new ObjectName("java.lang:type=ClassLoading"),
                 "LoadedClassCount",
                 Integer.class));
// End of instrumentation
     } catch (Exception ex) { ex.printStackTrace(); }
..


Best regards,
Frank

Frank Fock wrote:
> The generic JMX API is still under construction,
> however this week the first table (read-only) and scalar
> instrumentation has been successfully implemented.
> 
> I think I will need some more weeks to make the API
> complete and clean.
> 
> Best regards,
> Frank
> 
> Torsten Curdt wrote:
>>> > > We need to monitor a couple of machines and I am currently 
>>> evaluating
>>> > > on how to do that best. For many reasons SNMP would be the first
>>> > > joice. On the other hand the JVM already exposes many information 
>>> via
>>> > > JMX. How much work is left for the JMX-SNMP bridge?
>>> >
>>> > I am currently developing an add-on API for SNMP4J-Agent
>>> > that facilitates integrating JMX with the agent instrumentation.
>>> > As a proof of concept I am implementing the JVM-MANAGEMENT-MIB
>>> > with that API and without it (thus directly with SNMP4J-Agent
>>> > MO* objects and AgenPro generated stubs).
>>>
>>> Sounds good
>>
>> Frank any news on that?
>>
>> cheers
>> -- 
>> Torsten
>> _______________________________________________
>> 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