[SNMP4J] JMX Notification to SNMP Trap Mapping

Frank Fock fock at agentpp.com
Fri Apr 20 20:56:46 CEST 2007


Hi,

The JvmManagementMibInst.java contains the following
example code:

final MBeanServerConnection server =
     ManagementFactory.getPlatformMBeanServer();
final JMXNotificationSupport notificationSupport =
     new JMXNotificationSupport(notificationOriginator);

JMXIndexSupport jvmMemManagerIndexSupport =
   new AbstractSyntheticJMXIndexSupport() {
     public ObjectName mapToRowMBean(Object rowIdentifier) {
       try {
         return new ObjectName(ManagementFactory.
                               MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE +
                               ",name=" + rowIdentifier);
       }
       catch (Exception ex) {
         ex.printStackTrace();
         return null;
       }
     }
   };

ObjectName onameJvmMem =
   new ObjectName(ManagementFactory.MEMORY_MXBEAN_NAME);

notificationSupport.
   add(JvmManagementMib.oidJvmLowMemoryPoolUsageNotif,
       new MBeanNotificationInfo(
         jvmLowMemoryPoolUsageNotif,
         new JMXAttributeNotificationIndexSupport(
           new TypedAttribute("poolName", String.class),
         jvmMemManagerIndexSupport)));
try {
   server.addNotificationListener(onameJvmMem,
                                  notificationSupport, null,
                                  JvmManagementMib.
                                    oidJvmLowMemoryPoolUsageNotif);
}
catch (Exception ex) {
   ex.printStackTrace();
}

If you describe what kind of MBean Notification you want to map
to what NOTIFICATION-TYPE I would create the mapping for you.

Best regards,
Frank

hzg wrote:
> Hi,
>   
> Does anyone have any clue in mapping JMX Notification to SNMP Trap using snmp4j-agentjmx-1.0?   
> 
> Could you give some exmple code ?
>  
>  Regards
>  Hzg
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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