Bridging SNMP and JMX
I worked last year on an advanced development project for the CTO that aimed to provide telemetry data (Key Performance Indicators) to a Service Level Management (SLM) application prototype, writen in Java, and based on OSS/J APIs. A key objective was to be able to expose the observed resources as Java Management Extension (JMX) MBeans, while being able to leverage the huge amount of data already available from Solaris Master Agent and SunMC. I developed for that a generic SNMP MIB to Dynamic JMX MBean converter that I'll sketch the main design components.
The converter takes a MIB written in the SMI language, parses it, and generates corresponding MBeans whose attributes have the names of the elements of the MIB, and whose values are obtained by connecting to the remote SNMP agent. I found the free edition of SNMP API of Advantnet very helpful in parsing and representing MIB modules as Java objects. Check in particular the SNMP Beans packages.
This all happens at runtime, so you can take your running system and tell it to create some new MBeans for a new MIB. There is no separate code generation step as with JDMK's mibgen. Model MBeans are used so that the syntax information from the MIB is available in the MBeanInfo as descriptors.
Open types are used extensively. A MIB group is represented as a single CompositeData and a table is represented as a TabularData. Because, the implementation uses the Java Open Types, there is no need to export jar files on the client side, which is the reason why it works out-of-the-box in Jconsole. Java Open Types play very well here!
The figure below shows a Dynamic MBean representing a Solaris compute node in Jconsole:
In the figure above, three complex attributes (group and table) are developed so that, one can see what they look like in JConsole. Two MIBs (kernel-reader-mib and mib2-simple-mib)exported by the two different SNMP agents are aggregated into one Dynamic MBean view. The Dynamic MBean get the values of the kernel-reader-mib attributes from SunMC, and the mib2-simple-mib attributes from the Solaris Master Agent (net-snmp).
Two main interesting things you can take away from this:
- A use case for MBeans that is truly dynamic, i.e. the attributes' MBeanInfo is completely unknown at compile time, and entirely constructed at run time. Because of this, Open Types are essential in the design since the Java class of a complex attribute is unknown at compile time.
- A novel use of jconsole. With this bridge, you can use jconsole to visualize both JMX instrumentation and legacy SNMP data in one single view.
Posted at
04:09PM Nov 10, 2006
by ppetitsm in Sun |